Re: Precedence of new phrase search tsquery operator

From: Oleg Bartunov <obartunov(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Teodor Sigaev <teodor(at)sigaev(dot)ru>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Precedence of new phrase search tsquery operator
Date: 2016-06-08 17:08:53
Message-ID: CAF4Au4yrTOdFiVPNgWQyQV1a+38bNaoPJPvLF_GYAYo2wnXp0A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jun 8, 2016 at 7:13 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> It appears that the new <-> operator has been made to have exactly the
> same grammatical precedence as the existing & (AND) operator. Thus,
> for example, 'a & b <-> c'::tsquery means something different from
> 'b <-> c & a'::tsquery:
>
> regression=# select 'a & b <-> c'::tsquery;
> tsquery
> -----------------------------------
> ( 'a' <-> 'c' ) & ( 'b' <-> 'c' )
> (1 row)
>
> regression=# select 'b <-> c & a'::tsquery;
> tsquery
> -----------------------
> ( 'b' <-> 'c' ) & 'a'
> (1 row)
>
> I find this surprising. My intuitive feeling is that <-> ought to
> bind tighter than & (and therefore also tighter than |). What's
> the reasoning for making it act like this?

ah, now we remember :) The idea about equivalence of & and <->
operators appeared in situation when <-> degenerates to & in case of
absence of positional information. Looks like we mixed different
things, will fix.

>
> regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-06-08 17:12:00 Re: Should phraseto_tsquery('simple', 'blue blue') @@ to_tsvector('simple', 'blue') be true ?
Previous Message Oleg Bartunov 2016-06-08 16:59:33 Re: Precedence of new phrase search tsquery operator