Re: tsearch2 and case

From: Mike Rylander <mrylander(at)gmail(dot)com>
To: "Uwe C(dot) Schroeder" <uwe(at)oss4u(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: tsearch2 and case
Date: 2005-07-04 20:55:33
Message-ID: b918cf3d0507041355299e22c1@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 7/4/05, Uwe C. Schroeder <uwe(at)oss4u(dot)com> wrote:
>
> First of all: Happy Independence Day.
>
> I've got a quick question for those with tsearch2 experience.
> I set tsearch2 up and it works great (although I'd like to search for phrases
> too, but I guess that's not supported at this time).

To do phrase searching just add an additional WHERE clause to your query:

SELECT id FROM tab WHERE ts_idx_col @@ to_tsquery('history&lesson')
AND text_col ~* '.*history\\s+lesson.*';

The full-text index will still be used, and the regex will be used to
prune the results afterwards.

--
Mike Rylander
mrylander(at)gmail(dot)com
GPLS -- PINES Development
Database Developer
http://open-ils.org

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Net Virtual Mailing Lists 2005-07-05 04:47:02 How can this be optimized, if possible?
Previous Message Greg Stark 2005-07-04 20:53:25 Re: Transparent i18n?