tsearch comments

From: Björn Metzdorf <bm(at)turtle-entertainment(dot)de>
To: <pgsql-general(at)postgresql(dot)org>
Subject: tsearch comments
Date: 2003-01-22 22:43:22
Message-ID: 01bf01c2c267$b1643670$0564a8c0@shock
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I was browsing the archives for anything related to tsearch and stumbled
across a post from Christopher Kings-Lynne in Nov 2002. He suggested to have
txt2txtidx as an index function, but he had some problems implementing his
idea.

But his idea works very fine. Just apply the attached patch (against 7.3.1),
install tsearch as normal, and then

CREATE INDEX my_test_idx ON mytable using gist(txt2txtidx(mycolumn));

assuming "mycolumn" is a text-type column.

Then you can search "mycolumn" with

SELECT * FROM mytable WHERE txt2txtidx(mycolumn) ## 'patch&gist';

This method has several advantages:

- you don't have to extend your table with another column
- pg_dump's output won't be bloated
- you don't have to use a special trigger, the index keeps itself up to
date!

Besides, we tested tsearch also with arabian and chinese input, and it works
perfectly with unicode databases as well (although it must be the exact same
phrase, since the builtin stemmer cannot stem chinese :).

Oleg: Can you search your memory why txt2txtidx possibly should not be
marked as "iscachable"?
The rest: Is there perhaps a problem with this approach that I am not aware
of?

Regards,
Bjoern

Attachment Content-Type Size
tsearch_txt2txtidx_patch.txt text/plain 313 bytes

Browse pgsql-general by date

  From Date Subject
Next Message Björn Metzdorf 2003-01-22 22:58:35 Re: tsearch comments
Previous Message Tom Lane 2003-01-22 22:37:53 Re: Re agregates