On Thu, Mar 28, 2013 at 2:12 PM, Kevin Grittner <kgri...@ymail.com> 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'
>
> SELECT m.* FROM movies m
>   WHERE to_tsvector(m.item_title) @@ to_tsquery('Robocop & (DVD | 
> Collection)')

It wont return items that have 'Robocop' entry only.

[local]:5432 postgres@postgres=#
select to_tsvector('robocop') @@ to_tsquery('robocop & (dvd | collection)');
 ?column?
----------
 f
(1 row)

But to_tsquery('robocop | (robocop & (dvd | collection))')  will do the trick.

[local]:5432 postgres@postgres=#
select to_tsvector('robocop') @@ to_tsquery('robocop | (robocop & (dvd
| collection))');
 ?column?
----------
 t
(1 row)

--
Kind regards,
Sergey Konoplev
Database and Software Consultant

Profile: http://www.linkedin.com/in/grayhemp
Phone: USA +1 (415) 867-9984, Russia +7 (901) 903-0499, +7 (988) 888-1979
Skype: gray-hemp
Jabber: gray...@gmail.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