tokenize string for tsearch?

From: Ottavio Campana <ottavio(at)campana(dot)vi(dot)it>
To: "'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org>
Subject: tokenize string for tsearch?
Date: 2007-05-08 00:31:02
Message-ID: 463FC4C6.10608@campana.vi.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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 works "anded"
together?

Thank you

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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ottavio Campana 2007-05-08 00:31:14 change the stop words file for tsearch2
Previous Message Rich Shepard 2007-05-07 22:19:19 Re: Date Math