Search Postgresql Archives

Re: ts_tovector() to_query()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 28, 2013 at 2:12 PM, Kevin Grittner <kgrittn@xxxxxxxxx> 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.ru@xxxxxxxxx


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




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux