Re: Differences between to_tsquery() and plainto_tsquery() when it comes to applying an index?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Denis Papathanasiou <denis(dot)papathanasiou(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Differences between to_tsquery() and plainto_tsquery() when it comes to applying an index?
Date: 2010-08-25 18:48:05
Message-ID: 23285.1282762085@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Denis Papathanasiou <denis(dot)papathanasiou(at)gmail(dot)com> writes:
> Is this because the gin/to_tsvector() index works differently for
> to_tsquery() compared to plainto_ts_query() ?

Not per se, but maybe looking at the actual outputs of the two function
calls would be enlightening. I suspect you'll find that the search
conditions you are getting are not equivalent.

> Note that I need the plainto_tsquery() form b/c my search phrases will
> correspond to exact blocks of text, and therefore they will contain
> spaces and punctuation, etc.

In that case you haven't understood how text search works at all.
It simply doesn't do that. You could possibly follow up a text search
for component words with a LIKE or similar comparison to verify that
the matches actually contain the desired string.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2010-08-25 18:57:07 Re: recovery fail
Previous Message Wojciech Strzałka 2010-08-25 18:47:10 Re: Feature proposal