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

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

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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Steven Schlansker 2014-03-25 20:56:52 Trimming transaction logs after extended WAL archive failures
Previous Message John Smith 2014-03-25 20:40:35 tsearch2: how to plainto_tsquery() with "|"