Re: Updated tsearch documentation - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Updated tsearch documentation
Date
Msg-id 200707170520.l6H5KL213709@momjian.us
Whole thread Raw
In response to Re: Updated tsearch documentation  (Oleg Bartunov <oleg@sai.msu.su>)
Responses Re: Updated tsearch documentation  (Oleg Bartunov <oleg@sai.msu.su>)
List pgsql-hackers
I think the tsearch documentation is nearing completion:
http://momjian.us/expire/fulltext/HTML/textsearch.html

but I am not happy with how tsearch is enabled in a user table:
http://momjian.us/expire/fulltext/HTML/textsearch-app-tutorial.html

Aside from the fact that it needs more examples, it only illustrates an
example where someone creates a table, populates it, then adds a
tsvector column, populates that, then creates an index.

That seems quite inflexible.  Is there a way to avoid having a separate
tsvector column?  What happens if the table is dynamic?  How is that
column updated based on table changes?  Triggers?  Where are the
examples?  Can you create an index like this:
CREATE INDEX textsearch_id ON pgweb USING gin(to_tsvector(column));

That avoids having to have a separate column because you can just say:
WHERE to_query('XXX') @@ to_tsvector(column)

How do we make sure that the to_query is using the same text search
configuration as the 'column' or index?  Perhaps we should suggest:
 CREATE INDEX textsearch_idx ON pgweb USING gin(to_tsvector('english',column));

so that at least the configuration is documented in the index.

--  Bruce Momjian  <bruce@momjian.us>          http://momjian.us EnterpriseDB
http://www.enterprisedb.com
 + If your life is a hard drive, Christ can be your backup. +


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Rethinking user-defined-typmod before it's too late
Next
From: "Jaime Casanova"
Date:
Subject: Re: plpgsql FOR loop doesn't guard against strange step values