Search Postgresql Archives

tsearch2: How to use different configurations for two columns?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux