Re: tsquery error

From: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "'Stephen Davies *EXTERN*'" <sdavies(at)sdc(dot)com(dot)au>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: tsquery error
Date: 2017-07-11 07:28:52
Message-ID: A737B7A37273E048B164557ADEF4A58B53A815EF@ntex2010i.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Stephen Davies wrote:
> The following query give the error:
>
> select
> id,title,dtype,source,used_for,ts_headline('english',content,to_tsquery('english','
> ma waterflux'),'minWords = 99, maxWords = 999') from info where clob @@
> to_tsquery('english',' ma waterflux') order by title,dtype,source,used_for;
> ERROR: syntax error in tsquery: " ma waterflux"
>
> Remove either the "ma" or the "waterflux" and the query works.
>
> What is causing the error?
>
> (MA Waterflux is a product name.)

It is the fact that the string contains two words.

You would have to place an operator between the words,
probably & in that case.
(https://www.postgresql.org/docs/current/static/datatype-textsearch.html#DATATYPE-TSQUERY)

Or you use "plainto_tsquery" instead of "to_tsquery".

Yours,
Laurenz Albe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adam Brusselback 2017-07-11 11:55:22 Re: Materialised view - refresh
Previous Message Krithika Venkatesh 2017-07-11 06:28:55 Materialised view - refresh