Re: ts_tovector() to_query()

From: hubert depesz lubaczewski <depesz(at)depesz(dot)com>
To: "Severn, Chris" <chris_severn(at)chernay(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: ts_tovector() to_query()
Date: 2013-03-29 11:58:31
Message-ID: 20130329115831.GB3171@depesz.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Mar 28, 2013 at 08:50:50PM +0000, Severn, Chris wrote:
> What I want to do is return items that have 'Robocop' or 'Robocop and
> DVD' or 'Robocop and Collection' or 'Robocop and DVD and collection'

Based on the criteria above, I would say that:
SELECT m.* FROM movies m WHERE to_tsvector(m.item_title) @@ to_tsquery('Robocop')

will do what you need, since "dvd" and "collection" are irrelevant for
the results.

Best regards,

depesz

--
The best thing about modern society is how easy it is to avoid contact with it.
http://depesz.com/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Severn, Chris 2013-03-29 12:19:28 Re: ts_tovector() to_query()
Previous Message Tom Lane 2013-03-29 02:26:10 Re: Unexpected behaviour of encode()