From: | "Severn, Chris" <chris_severn(at)chernay(dot)com> |
---|---|
To: | "depesz(at)depesz(dot)com" <depesz(at)depesz(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 12:19:28 |
Message-ID: | 93EDA2D7FDE4774AB8258B97B8599D3802DB3C2B@gold.intra.chernay.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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 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: depesz(at)depesz(dot)com [mailto:depesz(at)depesz(dot)com]
Sent: Friday, March 29, 2013 7:59 AM
To: Severn, Chris
Cc: pgsql-general(at)postgresql(dot)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/
From | Date | Subject | |
---|---|---|---|
Next Message | Gavan Schneider | 2013-03-29 12:32:20 | Re: Money casting too liberal? |
Previous Message | hubert depesz lubaczewski | 2013-03-29 11:58:31 | Re: ts_tovector() to_query() |