mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Fix YA text phrase search bug.
checkcondition_str() failed to report multiple matches for a prefix pattern correctly: it would dutifully merge the match positions, but then after exiting that loop, if the last prefix-matching word had had no suitable positions, it would report there were no matches. The upshot would be failing to recognize a match that the query should match. It looks like you need all of these conditions to see the bug: * a phrase search (else we don't ask for match position details) * a prefix search item (else we don't get to this code) * a weight restriction (else checkclass_str won't fail) Noted while investigating a problem report from Pavel Borisov, though this is distinct from the issue he was on about. Back-patch to 9.6 where phrase search was added.
This commit is contained in:
@ -533,6 +533,24 @@ SELECT 'a b:89 ca:23A,64c cb:80b d:34c'::tsvector @@ 'd:AC & c:*B' as "true";
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT 'wa:1D wb:2A'::tsvector @@ 'w:*D & w:*A'::tsquery as "true";
|
||||
true
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT 'wa:1D wb:2A'::tsvector @@ 'w:*D <-> w:*A'::tsquery as "true";
|
||||
true
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT 'wa:1A wb:2D'::tsvector @@ 'w:*D <-> w:*A'::tsquery as "false";
|
||||
false
|
||||
-------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT 'supernova'::tsvector @@ 'super'::tsquery AS "false";
|
||||
false
|
||||
-------
|
||||
|
@ -101,6 +101,9 @@ SELECT 'a b:89 ca:23A,64b d:34c'::tsvector @@ 'd:AC & c:*CB' as "true";
|
||||
SELECT 'a b:89 ca:23A,64b cb:80c d:34c'::tsvector @@ 'd:AC & c:*C' as "true";
|
||||
SELECT 'a b:89 ca:23A,64c cb:80b d:34c'::tsvector @@ 'd:AC & c:*C' as "true";
|
||||
SELECT 'a b:89 ca:23A,64c cb:80b d:34c'::tsvector @@ 'd:AC & c:*B' as "true";
|
||||
SELECT 'wa:1D wb:2A'::tsvector @@ 'w:*D & w:*A'::tsquery as "true";
|
||||
SELECT 'wa:1D wb:2A'::tsvector @@ 'w:*D <-> w:*A'::tsquery as "true";
|
||||
SELECT 'wa:1A wb:2D'::tsvector @@ 'w:*D <-> w:*A'::tsquery as "false";
|
||||
|
||||
SELECT 'supernova'::tsvector @@ 'super'::tsquery AS "false";
|
||||
SELECT 'supeanova supernova'::tsvector @@ 'super'::tsquery AS "false";
|
||||
|
Reference in New Issue
Block a user