[DOCS] What's the difference between the ts_rank and ts_rank_cd?

Поиск
Список
Период
Сортировка
От hmidi slim
Тема [DOCS] What's the difference between the ts_rank and ts_rank_cd?
Дата
Msg-id CAMsqVxvbMX4dBbEyGxVtu7+zwDnRf2g+9QdOWN3eL6r3WwRA-A@mail.gmail.com
обсуждение исходный текст
Список pgsql-docs
Based on the official doc:
'PostgreSQL provides two predefined ranking functions, which take into account lexical, proximity, and structural information; that is, they consider how often the query terms appear in the document, how close together the terms are in the document, and how important is the part of the document where they occur.'

The definition of ts_rank:

'Ranks vectors based on the frequency of their matching lexemes.'
 
Definition of ts_rank_cd:

'This function computes the cover density ranking for the given document vector and query, as described in Clarke, Cormack, and Tudhope's "Relevance Ranking for One to Three Term Queries" in the journal "Information Processing and Management", 1999. Cover density is similar to ts_rankranking except that the proximity of matching lexemes to each other is taken into consideration.'

Testing the ts_rank function with these 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

why the function ts_rank gives different results however I have the same number of searched items on the different examples? does the distance was token into consideration into the ts_rank. If yes what's is the difference between ts_rank and ts_rank_cd which is differ from the first by  the proximity of matching lexemes?

В списке pgsql-docs по дате отправления:

Предыдущее
От: Oleg Bartunov
Дата:
Сообщение: Re: [DOCS] Ts_rank_cd function
Следующее
От: hmidi slim
Дата:
Сообщение: [DOCS] Explain the difference between ts_rank and ts_rank_cd