From: | Stephan Vollmer <svollmer(at)gmx(dot)de> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | tsearch2: How to use different configurations for two columns? |
Date: | 2005-12-09 14:57:49 |
Message-ID: | 43999B6D.4020500@gmx.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi all,
is it possible to index 2 columns in a table with tsearch2 using
different configurations for each column index?
I have a table publications that is defined as follows (simplified):
CREATE TABLE publications
(
title text,
author_list text,
fti_title tsvector,
fti_author_list tsvector,
)
WITHOUT OIDS;
CREATE INDEX idx_fti_author_list ON publications
USING gist (fti_author_list);
CREATE INDEX idx_fti_title ON publications
USING gist (fti_title);
CREATE TRIGGER tsvectorupdate_title
BEFORE INSERT OR UPDATE ON publications
FOR EACH ROW
EXECUTE PROCEDURE tsearch2('fti_title', 'title');
CREATE TRIGGER tsvectorupdate_author_list
BEFORE INSERT OR UPDATE ON publications
FOR EACH ROW
EXECUTE PROCEDURE tsearch2('fti_author_list', 'author_list');
The column 'author_list' contains names of authors with many
abbreviated first names, e. g. "S. Vollmer Michael F. Smith". These
abbreviated first names "S." and "F." shouldn't be indexed. To do
this, I created a tsearch2 configuration 'authors' that uses a
stopword list with "a...z" as stopwords.
The configuration seems to work fine, but I can't get tsearch2 to
use the 'author' config for column 'author_list' and 'default'
config for column 'title'. Is there any way to accomplish this?
If the solution is not possible or too complicated, as a workaround
I could use a function that deletes the abbreviated first names
before the column is indexed - similar to the function
"dropatsymbol()" mentioned in the tsearch2 documentation. I tried to
use replace(), but I'd need a function with regexps.
Thanks in advance,
- Stephan
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew J. Kopciuch | 2005-12-09 16:13:45 | Re: tsearch2: How to use different configurations for two columns? |
Previous Message | A. Kretschmer | 2005-12-09 14:40:44 | Re: pg_dump problems |