Re: Searching a DB index.. possible? - Mailing list pgsql-general

From Richard Huxton
Subject Re: Searching a DB index.. possible?
Date
Msg-id 4B743C69.805@archonet.com
Whole thread Raw
In response to Re: Searching a DB index.. possible?  (Moe <mohamed5432154321@gmail.com>)
List pgsql-general
On 11/02/10 17:11, Moe wrote:
>> You might want to summarize down to a separate (word,frequency) table.
>> Particularly if you don't want stemming to interfere with your suggestions.
>
> Stemming is ok. That's fine.
>
> How would this normally be implemented?  Should I go through my text word by
> word myself, or the already existing index and copy over to a new table? Not
> sure how this would be managable. Every change to something would require a
> word count down, and then a word up after.

I wouldn't bother keeping it 100% up-to-date. You only want the
most-plausible suggestions anyway. Have a look at the ts_stat() function.

http://www.postgresql.org/docs/8.4/interactive/textsearch-features.html

Run it overnight, and summarise to a separate table, then just use
"like" against it.

Otherwise, like you say, your database will spend most of its time
adding up word counts etc.

--
   Richard Huxton
   Archonet Ltd

pgsql-general by date:

Previous
From: "A. Kretschmer"
Date:
Subject: Re: Postgres Triggers issue
Next
From: Andreas Kretschmer
Date:
Subject: Re: Postgres Triggers issue