Thread: tsearch2 + trigram pairing

tsearch2 + trigram pairing

From
Viljo Marrandi
Date:
Hello,

I'm trying to figure out how to get tsearch2 and pg_trgm working
together nicely. I have successfully installed both of them on
Postgresql 8.0.3.

Let's say I've one table 'info' with field 'words' in it. I created
'words_idx tsvector' field from it and populated it with some data.
Following README.pg_trgm I created new table for trigram like 'CREATE
TABLE trgm_words AS ...' containing all unique words from 'words_idx'

Now the problem is, when I do trigram matching against 'trgm_words'
table and find some matches, then I've no way to know to which record
these belong in info table. Is there some easier or more better way to
find it out, or do I have to make some subselect or something.

Thanks in advance,
Viljo