Explain the difference between ts_rank and ts_rank_cd

From: hmidi slim <hmidi(dot)slim2(at)gmail(dot)com>
To: pgsql-docs(at)postgresql(dot)org
Subject: Explain the difference between ts_rank and ts_rank_cd
Date: 2017-11-03 13:14:19
Message-ID: CAMsqVxs-ozWnm3KEFgfiKDPtq77SK8FNAXykpmxTvjub8RSjKQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

According to the official documentation of a postgresql, the difference
between the function ts_rank and ts_rank_cd is not clear.
According to the documentation:
*ts_rank ranks vectors based on the frequency of their matching lexemes.*
And ts_rank_cd :
*This function computes the cover density ranking for the given document
vector and query. Cover density is similar to ts_rankranking except that
the proximity of matching lexemes to each other is taken into
consideration.*

*But when trying some examples:*

SELECT ts_rank( to_tsvector('name lastname name lastname'),
to_tsquery('name & lastname'));

ts_rank:0,3400053
SELECT ts_rank( to_tsvector('name lastname zzzzzzzz tttttt name lastname'),
to_tsquery('name & lastname'));

ts_rank:0,3344279
SELECT ts_rank( to_tsvector('name lastname xxxxx yyyyyyy zzzzzzzz tttttt
name lastname'), to_tsquery('name & lastname'));

ts_rank:0,3187879

Based to these results I found that even the ts_rank maybe uses the *proximity
of matching lexemes which is a feature of ts_rank_cd.*

Could you provide us some more examples fo the different ranking functions
and what is the difference between them?

Browse pgsql-docs by date

  From Date Subject
Next Message Peter Eisentraut 2017-11-03 18:29:21 Re: backpatching documentation after conversion to XML
Previous Message hmidi slim 2017-11-03 10:52:03 What's the difference between the ts_rank and ts_rank_cd?