Re: bug in ts_rank_cd

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: bug in ts_rank_cd
Дата
Msg-id 23981.1292990635@sss.pgh.pa.us
обсуждение исходный текст
Ответ на bug in ts_rank_cd  (Sushant Sinha <sushant354@gmail.com>)
Ответы Re: bug in ts_rank_cd  (Sushant Sinha <sushant354@gmail.com>)
Список pgsql-hackers
Sushant Sinha <sushant354@gmail.com> writes:
> There is a bug in ts_rank_cd. It does not correctly give rank when the
> query lexeme is the first one in the tsvector.

Hmm ... I cannot reproduce the behavior you're complaining of.
You say

> select ts_rank_cd(to_tsvector('english', 'abc sdd'),
> plainto_tsquery('english', 'abc'));   
>  ts_rank_cd 
> ------------
>           0

but I get

regression=# select ts_rank_cd(to_tsvector('english', 'abc sdd'),
regression(# plainto_tsquery('english', 'abc'));   ts_rank_cd 
------------       0.1
(1 row)

> The problem is that the Cover finding algorithm ignores the lexeme at
> the 0th position,

As far as I can tell, there is no "0th position" --- tsvector counts
positions from one.  The only way to see pos == 0 in the input to
Cover() is if the tsvector has been stripped of position information.
ts_rank_cd is documented to return 0 in that situation.  Your patch
would have the effect of causing it to return some nonzero, but quite
bogus, ranking.
        regards, tom lane


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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: CommitFest wrap-up
Следующее
От: Tom Lane
Дата:
Сообщение: Re: strncmp->memcmp when we know the shorter length