Re: ts_tovector() to_query()

From: Sergey Konoplev <gray(dot)ru(at)gmail(dot)com>
To: Kevin Grittner <kgrittn(at)ymail(dot)com>
Cc: "Severn, Chris" <chris_severn(at)chernay(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: ts_tovector() to_query()
Date: 2013-03-28 23:48:26
Message-ID: CAL_0b1uk5uVnNdb+KiR1f-X6vbjHqWeog+276Q9u4rFmTDOexg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Mar 28, 2013 at 2:12 PM, Kevin Grittner <kgrittn(at)ymail(dot)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(at)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(at)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(dot)ru(at)gmail(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Chris Angelico 2013-03-29 00:05:41 Re: Money casting too liberal?
Previous Message Jasen Betts 2013-03-28 23:39:27 Re: Money casting too liberal?