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 simply search for 'Robocop' that would 
work. But how do I handle the search if they type in more than one word and 
still return half 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 up more on ranking in the postgres 
docs. I skimmed past it since it didn't seem to apply, but now looking over it 
again, I think it could help.

Thanks.
Chris

-----Original Message-----
From: dep...@depesz.com [mailto:dep...@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/

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to