Re: ts_tovector() to_query() - Mailing list pgsql-general

From Severn, Chris
Subject Re: ts_tovector() to_query()
Date
Msg-id 93EDA2D7FDE4774AB8258B97B8599D3802DB3C2B@gold.intra.chernay.com
Whole thread Raw
In response to Re: ts_tovector() to_query()  (hubert depesz lubaczewski <depesz@depesz.com>)
List pgsql-general
Because the query is what the user is typing in. I don't know what words the user is going to search for. if they
simplysearch for 'Robocop' that would work. But how do I handle the search if they type in more than one word and still
returnhalf way accurate results? 
 

I suppose after talking through it a bit, this may be more of a ranking issue than an actual query issue. I will read
upmore on ranking in the postgres docs. I skimmed past it since it didn't seem to apply, but now looking over it again,
Ithink it could help.
 

Thanks.
Chris

-----Original Message-----
From: depesz@depesz.com [mailto:depesz@depesz.com] 
Sent: Friday, March 29, 2013 7:59 AM
To: Severn, Chris
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] ts_tovector() to_query()

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/

pgsql-general by date:

Previous
From: hubert depesz lubaczewski
Date:
Subject: Re: ts_tovector() to_query()
Next
From: Gavan Schneider
Date:
Subject: Re: Money casting too liberal?