Re: Fastest Index/Algorithm to find similar sentences

From: Sergey Konoplev <gray(dot)ru(at)gmail(dot)com>
To: Janek Sendrowski <janek12(at)web(dot)de>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Fastest Index/Algorithm to find similar sentences
Date: 2013-07-30 03:54:25
Message-ID: CAL_0b1uQc0Dm5VipD7ULAQD3HUPYsZ2z=aeFPdciDQwV1yDj3Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, Jul 27, 2013 at 10:04 AM, Janek Sendrowski <janek12(at)web(dot)de> wrote:
> If I'm searching for a sentence like "The tiger is the largest cat species" for example.
> I can only find the sentences, which include the words "tiger, largest, cat, species", but I also like to have the sentences with only three or even two of these words.

You can use & (AND), | (OR), and ! (NOT) operators in tsquery, so you
can achieve what you want just like this:

[local]:5432 grayhemp(at)grayhemp=# select to_tsquery('tiger | largest |
cat | species') @@ to_tsvector('The tiger is the largest cat');
?column?
----------
t

Or may be I understand something wrong again?

>
> Janek
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general

--
Kind regards,
Sergey Konoplev
PostgreSQL Consultant and DBA

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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sajeev Mayandi 2013-07-30 04:05:16 to know what columns are getting updated
Previous Message Amit Langote 2013-07-30 00:29:22 Re: [HACKERS] maintenance_work_mem and CREATE INDEX time