Re: Differences between to_tsquery() and plainto_tsquery() when it comes to applying an index? - Mailing list pgsql-general

From Tom Lane
Subject Re: Differences between to_tsquery() and plainto_tsquery() when it comes to applying an index?
Date
Msg-id 23285.1282762085@sss.pgh.pa.us
Whole thread Raw
In response to Differences between to_tsquery() and plainto_tsquery() when it comes to applying an index?  (Denis Papathanasiou <denis.papathanasiou@gmail.com>)
Responses Re: Differences between to_tsquery() and plainto_tsquery() when it comes to applying an index?
List pgsql-general
Denis Papathanasiou <denis.papathanasiou@gmail.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

pgsql-general by date:

Previous
From: Wojciech Strzałka
Date:
Subject: Re: Feature proposal
Next
From: Scott Marlowe
Date:
Subject: Re: recovery fail