Re: OR tsquery - Mailing list pgsql-general

From Ivan Sergio Borgonovo
Subject Re: OR tsquery
Date
Msg-id 20100116215703.6d2b79a9@dawn.webthatworks.it
Whole thread Raw
In response to Re: OR tsquery  (Oleg Bartunov <oleg@sai.msu.su>)
Responses ranking how "similar" are tsvectors was: OR tsquery  (Ivan Sergio Borgonovo <mail@webthatworks.it>)
List pgsql-general
On Sat, 16 Jan 2010 19:10:45 +0300 (MSK)
Oleg Bartunov <oleg@sai.msu.su> wrote:

> Ivan,

> did you ever read official documentation ?
> http://www.postgresql.org/docs/8.4/static/textsearch-controls.html

Yes but I still can't find something that works like plainto_tsquery
but with | or any example that wouldn't make obtaining that result
convoluted.

plainto_tsquery do a couple of stuff that I find hard to replicate
with the available functions.
It split a string into lexemes.
It loops over the lexemes to build up the query with &.

Something like:

select (
  string_to_array(
    strip(
    to_tsvector('pg_catalog.english',
      'orange banana woods booking'))::text
   , ' ')
   )[i]
  from generate_series(0,3) s(i);

and then gluing up the pieces with |.

And the above example still miss to solve some of the details like
cleaning the '.

Another option would be to return the tsvector to the client and
then build the tsquery there and send it back to the server.

I'm on 8.3 but I don't think it makes any real difference for this.

Sorry if I'm still missing the obvious.

--
Ivan Sergio Borgonovo
http://www.webthatworks.it


pgsql-general by date:

Previous
From: Mathieu De Zutter
Date:
Subject: Re: Constraint exclusion issue
Next
From: Greg Stark
Date:
Subject: Re: Collate order on Mac OS X, text with diacritics in UTF-8