Re: tokenize string for tsearch?

From: Ottavio Campana <ottavio(at)campana(dot)vi(dot)it>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: "'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org>
Subject: Re: tokenize string for tsearch?
Date: 2007-05-10 23:19:48
Message-ID: 4643A894.3030807@campana.vi.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Magnus Hagander wrote:
> On Mon, May 07, 2007 at 05:31:02PM -0700, Ottavio Campana wrote:
>> Hi, I'm trying to use tsearch2 for the first time and I'm having a
>> problem setting up a query
>>
>> If I execute
>>
>> SELECT * from test_table where ts_desc @@ to_tsquery ('hello&world');
>>
>> it works, but I'm having the problem that the string used for the query
>> is not 'hello&world' but 'hello world', Moreover, it can have an
>> arbitrary number of spaces between the words, so I cannot just
>> substitute the spaces with &, because 'hello&&world' gives error.
>>
>> What is the safest way transform a string into a list of words "anded"
>> together?
>
> Look at plainto_tsquery().

db=# SELECT plainto_tsquery('default', 'hello word');
ERROR: function plainto_tsquery("unknown", "unknown") does not exist
HINT: No function matches the given name and argument types. You may
need to add explicit type casts.

I'm using 8.1.8 and I don't find plainto_tsquery in tsearch2.sql

What can I do?

Thank you.

--
Non c'e' piu' forza nella normalita', c'e' solo monotonia.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dhaval Shah 2007-05-11 00:11:24 Re: WAL file internals and why a 64 bit will not work on a 32 bit
Previous Message Ron St-Pierre 2007-05-10 23:13:01 Re: Pattern Matching - Range of Letters