pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: magicagent@gmail.com
Subject: BUG #17569: false negative / positive results when using  <-> (followed by) and tsvector limit (16383)  hit
Date: Wed, 03 Aug 2022 17:51:10 +0000
Message-ID: <17569-47d11a72a38bf8ae@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      17569
Logged by:          Alex Malek
Email address:      magicagent@gmail.com
PostgreSQL version: 14.4
Operating system:   Red Hat
Description:        

It is well documented that "Position values in tsvector must be greater than
0 and no more than 16,383"

However these limits can result in false positive or false negative search
results 
doing a FOLLOWED BY / phrase search in a document w/ more than 16,383
words.

The false negative seems particularly bad / unexpected.

The false positive results happen when a word is at or before before
position 16,382, then every word at or past position 16,383 appears to be at
16,383

SELECT tq, text, text @@ tq AS ok,  repeat(' foo ',16381) || text @@ tq AS
false_pos
FROM (VALUES( websearch_to_tsquery('"red cat"'), 'red dogs chase with black
cats' )) t(tq, text) ;
       tq        |              text              | ok | false_pos
-----------------+--------------------------------+----+-----------
 'red' <-> 'cat' | red dogs chase with black cats | f  | t
(1 row)

The false negative happens for any phrase that exists at or after position
16,383 since all words appear to be at 16,383

# SELECT tq, text, text @@ tq AS small,  repeat(' foo ',16381) || text @@ tq
AS false_neg
FROM (VALUES( websearch_to_tsquery('"black cat"'), 'red dogs chase with
black cats' )) t(tq, text) ;
        tq         |              text              | small | false_neg
-------------------+--------------------------------+-------+-----------
 'black' <-> 'cat' | red dogs chase with black cats | t     | f
(1 row)



Message-ID: <17569-47d11a72a38bf8ae@postgresql.org>
Permalink:  ../17569-47d11a72a38bf8ae@postgresql.org/
Also on:    postgresql.org/message-id/17569-47d11a72a38bf8ae@postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, magicagent@gmail.com
  Subject: Re: BUG #17569: false negative / positive results when using  <-> (followed by) and tsvector limit (16383)  hit
  In-Reply-To: <17569-47d11a72a38bf8ae@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox