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

From Sergey Konoplev
Subject Re: ts_tovector() to_query()
Date
Msg-id CAL_0b1uk5uVnNdb+KiR1f-X6vbjHqWeog+276Q9u4rFmTDOexg@mail.gmail.com
Whole thread Raw
In response to Re: ts_tovector() to_query()  (Kevin Grittner <kgrittn@ymail.com>)
List pgsql-general
On Thu, Mar 28, 2013 at 2:12 PM, Kevin Grittner <kgrittn@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.ru@gmail.com


pgsql-general by date:

Previous
From: Martín Marqués
Date:
Subject: Re: pg_stat_get_last_vacuum_time(): why non-FULL?
Next
From: Jasen Betts
Date:
Subject: Re: Money casting too liberal?