Question about ranking & full text

From: Nicolas Paris <niparisco(at)gmail(dot)com>
To: Forums postgresql <pgsql-general(at)postgresql(dot)org>
Subject: Question about ranking & full text
Date: 2016-04-15 12:47:48
Message-ID: CA+ssMOShk+tir9gbcL0HR-s3CrpjHjxthxrTVMRKYd9o3HMfeA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,
I wonder why the third query returns 0.
To me, it would return 0.1, because there is not baz in the text

Thanks !
(pg 9.4)

SELECT ts_rank_cd(apod.t, query,4) AS rank
FROM (SELECT to_tsvector('foo baz') as t) as apod, to_tsquery('foo & baz')
query
WHERE query @@ apod.t;
rank |
------------|
0.100000001 |

SELECT ts_rank_cd(apod.t, query,4) AS rank
FROM (SELECT to_tsvector('foo ') as t) as apod, to_tsquery('foo & ! baz')
query
WHERE query @@ apod.t;

rank |
------------|
0.100000001 |

SELECT ts_rank_cd(apod.t, query,4) AS rank
FROM (SELECT to_tsvector('foo ') as t) as apod, to_tsquery(' ! baz') query
WHERE query @@ apod.t;

rank |
------------|
0.0 |

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Artur Zakirov 2016-04-15 13:44:03 Re: Question about ranking & full text
Previous Message Alexey Bashtanov 2016-04-15 08:05:12 Re: Deadlock between VACUUM and ALTER TABLE commands