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?

Reply via email to