Re: two questions about fulltext searchign / tsvector indexes - Mailing list pgsql-general

From Kevin Grittner
Subject Re: two questions about fulltext searchign / tsvector indexes
Date
Msg-id 1402406586.76014.YahooMailNeo@web122301.mail.ne1.yahoo.com
Whole thread Raw
In response to Re: two questions about fulltext searchign / tsvector indexes  (Vick Khera <vivek@khera.org>)
List pgsql-general
Vick Khera <vivek@khera.org> wrote:

> Jonathan Vanasco <postgres@2xlp.com> wrote:

> Personally in these days of cheap disks I'd go with the dedicated
> column. Given that, you want to just have a GIN index on that one
> column, and the query you want, given some plain text string like
> "fluffy dog" is this:
>
> select plainto_tsquery('fluffy dog') @@ my_tsv_column;
>
> I always use a trigger on insert and update to maintain the ts_vector
> column, so there is no doubt of how it was computed by various
> programs.

I was going to make a similar recommendation, but Vick beat me to
it.  The only thing I would add, is that you might want to consider
whether a match in one column should carry more weight than a match
in the other column.  If so, you should convert each to a tsvector
separately, and give each one a different weight before
concatenating the tsvector objects and storing the result.

http://www.postgresql.org/docs/current/interactive/textsearch-features.html#TEXTSEARCH-MANIPULATE-TSVECTOR

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


pgsql-general by date:

Previous
From: Vick Khera
Date:
Subject: Re: two questions about fulltext searchign / tsvector indexes
Next
From: Adrian Klaver
Date:
Subject: Re: pg_standby replication problem