PostgreSQL Bugs

Collected from the PG bugs email list.

Bug ID16235
PG Version12.1
OSLinux
Opened2020-01-27 20:04:26+00
Reported byDominik Giger
StatusNew

Body of first available message related to this bug follows.

The following bug has been logged on the website:

Bug reference:      16235
Logged by:          Dominik Giger
Email address:      (redacted)
PostgreSQL version: 12.1
Operating system:   Linux
Description:        

The following query shows the problem:

select ts_rank(doc1, query) as rank_wrong, ts_rank(doc2, query) as
rank_correct
from (select setweight(to_tsvector('simple', 'foo something'), 'A') ||
             setweight(to_tsvector('simple', 'foobar'), 'C')    as doc1,
             setweight(to_tsvector('simple', 'foo something'), 'A') as
doc2,
             to_tsquery('simple', 'foo:* & something')               as
query) as subquery;

Some more explanation:

doc1 looks like this: 
'foo':1A 'foobar':3C 'something':2A

doc2 looks like this:
'foo':1A 'something':2A

Calling ts_rank on both vectors with the same query
'foo':* & 'something'

Expected result: 
ts_rank on doc1 is the same or higher than ts_rank on doc2.

Actual result: 
ts_rank on doc1 is only half of the rank of doc2. ts_rank seems to only
consider the 'foobar' term with lower weight when calculating the rank. The
foo:1A is only considered in doc2.

Messages

DateAuthorSubject
2020-01-27 20:04:26+00PG Bug reporting formBUG #16235: ts_rank ignores match and only considers lower weighted vector
2020-01-27 22:34:58+00Tom LaneRe: BUG #16235: ts_rank ignores match and only considers lower weighted vector
2020-01-28 10:50:20+00Dominik GigerRe: BUG #16235: ts_rank ignores match and only considers lower weighted vector