| 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>, Jean-Pierre Pelletier <jppelletier(at)e-djuster(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: Should phraseto_tsquery('simple', 'blue blue') @@ to_tsvector('simple', 'blue') be true ? |
| Date: | 2016-06-08 20:33:59 |
| Message-ID: | CAF4Au4zykVx3gjpVFkzZSRynijGckGfwn1JY7QNvCYChj1=2Hg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Wed, Jun 8, 2016 at 8:12 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Another thing I noticed: if you test with tsvectors that don't contain
> position info, <-> seems to reduce to &, that is it doesn't enforce
> relative position:
>
> regression=# select 'cat bat fat rat'::tsvector @@ 'cat <-> rat'::tsquery;
> ?column?
> ----------
> t
> (1 row)
>
> regression=# select 'rat cat bat fat'::tsvector @@ 'cat <-> rat'::tsquery;
> ?column?
> ----------
> t
> (1 row)
yes, that's documented behaviour.
>
> I'm doubtful that this is a good behavior, because it seems like it can
> silently mask mistakes. That is, applying <-> to a stripped tsvector
> seems like user error to me. Actually throwing an error might be too
> much, but perhaps we should make such cases return false not true?
it's question of convention. Probably, returning false will quickly
indicate user
on his error, so such behaviour looks better.
>
> (This is against HEAD, without the patch I suggested yesterday.
> It strikes me that that patch might change this behavior, if the
> lexemes are all being treated as having position zero, but I have
> not checked.)
I didn't see the patch yet.
>
> regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Oleg Bartunov | 2016-06-08 20:39:42 | Re: Should phraseto_tsquery('simple', 'blue blue') @@ to_tsvector('simple', 'blue') be true ? |
| Previous Message | Oleg Bartunov | 2016-06-08 20:27:18 | Re: Should phraseto_tsquery('simple', 'blue blue') @@ to_tsvector('simple', 'blue') be true ? |