Re: [HACKERS] Should phraseto_tsquery('simple', 'blue blue') @@ to_tsvector('simple', 'blue') be true ?

2016-06-20 Thread Tom Lane
Teodor Sigaev writes: >> We're really quickly running out of time to get this done before >> beta2. Please don't commit anything that's going to break the tree >> because we only have about 72 hours before the wrap, but if it's >> correct then it should go in. > Isn't late

Re: [HACKERS] Should phraseto_tsquery('simple', 'blue blue') @@ to_tsvector('simple', 'blue') be true ?

2016-06-20 Thread Teodor Sigaev
We're really quickly running out of time to get this done before beta2. Please don't commit anything that's going to break the tree because we only have about 72 hours before the wrap, but if it's correct then it should go in. Isn't late now? Or wait to beta2 is out? -- Teodor Sigaev

Re: [HACKERS] Should phraseto_tsquery('simple', 'blue blue') @@ to_tsvector('simple', 'blue') be true ?

2016-06-17 Thread Robert Haas
On Fri, Jun 17, 2016 at 11:07 AM, Teodor Sigaev wrote: >>> Such algorithm finds closest pair of (Lpos, Rpos) but satisfying pair >>> could be >>> not closest, example: to_tsvector('simple', '1 2 1 2') @@ '1 <3> 2'; >> >> >> Oh ... the indexes in the lists don't have much to do

Re: [HACKERS] Should phraseto_tsquery('simple', 'blue blue') @@ to_tsvector('simple', 'blue') be true ?

2016-06-17 Thread Teodor Sigaev
Such algorithm finds closest pair of (Lpos, Rpos) but satisfying pair could be not closest, example: to_tsvector('simple', '1 2 1 2') @@ '1 <3> 2'; Oh ... the indexes in the lists don't have much to do with the distances, do they. OK, maybe it's not quite as easy as I was thinking. I'm okay

Re: [HACKERS] Should phraseto_tsquery('simple', 'blue blue') @@ to_tsvector('simple', 'blue') be true ?

2016-06-17 Thread Tom Lane
Teodor Sigaev writes: > Tom Lane wrote: >> Hmm, couldn't the loop logic be simplified a great deal if this is the >> definition? Or are you leaving it like that with the idea that we might >> later introduce another operator with the less-than-or-equal behavior? > Do you

Re: [HACKERS] Should phraseto_tsquery('simple', 'blue blue') @@ to_tsvector('simple', 'blue') be true ?

2016-06-17 Thread Teodor Sigaev
Tom Lane wrote: Teodor Sigaev writes: So I think there's a reasonable case for decreeing that should only match lexemes *exactly* N apart. If we did that, we would no longer have the misbehavior that Jean-Pierre is complaining about, and we'd not need to argue about

Re: [HACKERS] Should phraseto_tsquery('simple', 'blue blue') @@ to_tsvector('simple', 'blue') be true ?

2016-06-16 Thread Tom Lane
Teodor Sigaev writes: >> So I think there's a reasonable case for decreeing that should only >> match lexemes *exactly* N apart. If we did that, we would no longer have >> the misbehavior that Jean-Pierre is complaining about, and we'd not need >> to argue about whether <0>

Re: [HACKERS] Should phraseto_tsquery('simple', 'blue blue') @@ to_tsvector('simple', 'blue') be true ?

2016-06-15 Thread Teodor Sigaev
We need to reach a consensus here, since there is no way to say "I don't know". I inclined to agree with you, that returning false is better in such a case.That will indicate user to the source of problem. Here is a patch, now phrase operation returns false if there is not postion information.

Re: [HACKERS] Should phraseto_tsquery('simple', 'blue blue') @@ to_tsvector('simple', 'blue') be true ?

2016-06-15 Thread Teodor Sigaev
what's about word with several infinitives select to_tsvector('en', 'leavings'); to_tsvector 'leave':1 'leavings':1 (1 row) select to_tsvector('en', 'leavings') @@ 'leave <0> leavings'::tsquery; ?column? -- t (1 row) Second example is not

Re: [HACKERS] Should phraseto_tsquery('simple', 'blue blue') @@ to_tsvector('simple', 'blue') be true ?

2016-06-09 Thread Oleg Bartunov
On Thu, Jun 9, 2016 at 12:47 AM, Tom Lane wrote: > Oleg Bartunov writes: >> On Wed, Jun 8, 2016 at 8:12 PM, Tom Lane wrote: >>> Another thing I noticed: if you test with tsvectors that don't contain >>> position info, <-> seems to

Re: [HACKERS] Should phraseto_tsquery('simple', 'blue blue') @@ to_tsvector('simple', 'blue') be true ?

2016-06-08 Thread Tom Lane
Oleg Bartunov writes: > On Wed, Jun 8, 2016 at 8:12 PM, Tom Lane 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: > yes, that's

Re: [HACKERS] Should phraseto_tsquery('simple', 'blue blue') @@ to_tsvector('simple', 'blue') be true ?

2016-06-08 Thread Tom Lane
Oleg Bartunov writes: > On Wed, Jun 8, 2016 at 1:05 AM, Tom Lane wrote: >> I concur that that seems like a rather useless behavior. If we have >> "x <-> y" it is not possible to match at distance zero, while if we >> have "x <-> x" it seems unlikely that

Re: [HACKERS] Should phraseto_tsquery('simple', 'blue blue') @@ to_tsvector('simple', 'blue') be true ?

2016-06-08 Thread Oleg Bartunov
On Wed, Jun 8, 2016 at 1:05 AM, Tom Lane wrote: > Jean-Pierre Pelletier writes: >> I wanted to test if phraseto_tsquery(), new with 9.6 could be used for >> matching consecutive words but it won't work for us if it cannot handle >> consecutive

Re: [HACKERS] Should phraseto_tsquery('simple', 'blue blue') @@ to_tsvector('simple', 'blue') be true ?

2016-06-08 Thread Oleg Bartunov
On Wed, Jun 8, 2016 at 8:12 PM, Tom Lane 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 <->

Re: [HACKERS] Should phraseto_tsquery('simple', 'blue blue') @@ to_tsvector('simple', 'blue') be true ?

2016-06-08 Thread Jean-Pierre Pelletier
Sigaev; Oleg Bartunov Cc: Jean-Pierre Pelletier; pgsql-hackers@postgresql.org Subject: Re: [HACKERS] Should phraseto_tsquery('simple', 'blue blue') @@ to_tsvector('simple', 'blue') be true ? Another thing I noticed: if you test with tsvectors that don't contain position info, <-> seem

Re: [HACKERS] Should phraseto_tsquery('simple', 'blue blue') @@ to_tsvector('simple', 'blue') be true ?

2016-06-08 Thread Oleg Bartunov
t') @@ to_tsquery('simple', > 'cat <-> rat'); > returns "true" > > Jean-Pierre Pelletier > > -Original Message- > From: Tom Lane [mailto:t...@sss.pgh.pa.us] > Sent: Wednesday, June 8, 2016 1:12 PM > To: Teodor Sigaev; Oleg Bartunov > Cc: Jean-Pierre Pe

Re: [HACKERS] Should phraseto_tsquery('simple', 'blue blue') @@ to_tsvector('simple', 'blue') be true ?

2016-06-08 Thread Tom Lane
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

Re: [HACKERS] Should phraseto_tsquery('simple', 'blue blue') @@ to_tsvector('simple', 'blue') be true ?

2016-06-07 Thread Tom Lane
Jean-Pierre Pelletier writes: > I wanted to test if phraseto_tsquery(), new with 9.6 could be used for > matching consecutive words but it won't work for us if it cannot handle > consecutive *duplicate* words. > For example, the following returns true:select >

[HACKERS] Should phraseto_tsquery('simple', 'blue blue') @@ to_tsvector('simple', 'blue') be true ?

2016-06-07 Thread Jean-Pierre Pelletier
Hi, I wanted to test if phraseto_tsquery(), new with 9.6 could be used for matching consecutive words but it won't work for us if it cannot handle consecutive *duplicate* words. For example, the following returns true:select phraseto_tsquery('simple', 'blue blue') @@ to_tsvector('simple',