| From: | Magnus Hagander <magnus(at)hagander(dot)net> |
|---|---|
| To: | Ottavio Campana <ottavio(at)campana(dot)vi(dot)it> |
| Cc: | "'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: tokenize string for tsearch? |
| Date: | 2007-05-08 07:18:52 |
| Message-ID: | 20070508071852.GA25542@svr2.hagander.net |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
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 works "anded"
> together?
Look at plainto_tsquery().
//Magnus
| From | Date | Subject | |
|---|---|---|---|
| Next Message | PFC | 2007-05-08 08:29:09 | Re: Slow query and indexes... |
| Previous Message | Albe Laurenz | 2007-05-08 07:02:04 | Re: problem with a conditional statement |