Re: tsearch2

From: John DeSoi <desoi(at)pgedit(dot)com>
To: Chris Hoover <revoohc(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: tsearch2
Date: 2006-06-15 00:10:25
Message-ID: 2C238342-A122-4617-A2E4-E1887E71D776@pgedit.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Jun 14, 2006, at 6:29 PM, Chris Hoover wrote:

> How do you set it up to search for "how now brown cow" vs how now
> brown cow? The first example is looking for the exact phrase of
> words, while the second is just looking for all of the works.

Your select would have two conditions, one to find rows with the
words using the tsearch2 index and then a filtering condition (e.g.
AND like '%how now brown cow%'). How effective this is depends a lot
on your data, but it works well as long as the indexed search can
return a reasonably small set for the sequential scan on the
filtering condition.

There is an example in the documentation if you need more details.

John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL

In response to

  • tsearch2 at 2006-06-14 22:29:46 from Chris Hoover

Browse pgsql-general by date

  From Date Subject
Next Message Linux Portal 2006-06-15 02:18:44 How to optimize PostgreSQL database size
Previous Message Jim C. Nasby 2006-06-14 22:49:28 Re: table has many to many relationship with itself - how to implement?