Re: tsearch2: how to plainto_tsquery() with "|"

From: John Smith <jayzee(dot)smith(at)gmail(dot)com>
To: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: tsearch2: how to plainto_tsquery() with "|"
Date: 2014-03-25 21:33:52
Message-ID: CAMZ8qd9OtTc2K7UtXdAs11HyyB_eAD9rQi-aTSqDjy8BJcEVpA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

i thought you shared my frustration :-) (see
http://postgresql.1045698.n5.nabble.com/tsearch2-plainto-tsquery-with-OR-td1885955.html).
anyway, then "...plainto_tsquery('...')" is pretty much useless when
it fails if someone inserts a single boolean operator - back to
"...to_tsquery('...')" and inserting operators outside tsearch2. thks,
jzs

http://postgresql.1045698.n5.nabble.com/OR-tsquery-td1910087.html

On 3/25/14, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> John Smith <jayzee(dot)smith(at)gmail(dot)com> writes:
>> i can run "...@@ to_tsquery('cat | dog')".
>> but if i run "...@@ to_tsquery('cat dog')", it gives me a syntax error
>> (#42601).
>> so i run "...@@ plainto_tsquery('cat dog')".
>> but then i can't run "...@@ plainto_tsquery('cat | dog')".
>
> Yeah ... that's pretty much exactly the point of having two different
> functions. to_tsquery() honors boolean operators in the query, the other
> doesn't.
>
> If this doesn't fit your notions of a reasonable API, maybe you could
> create your own preprocessing function.
>
> regards, tom lane
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alfonso Afonso 2014-03-25 21:38:35 Re: Upgrading from 9.2 to 9.3 causes performance degradation
Previous Message Brian Crowell 2014-03-25 21:21:46 Re: PG choosing nested loop for set membership?