Re: BUG #16744: ts_headline behaves incorrectly with <-> and proximity operators

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #16744: ts_headline behaves incorrectly with <-> and proximity operators
Дата
Msg-id 501699.1606333250@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #16744: ts_headline behaves incorrectly with <-> and proximity operators  (PG Bug reporting form <noreply@postgresql.org>)
Список pgsql-bugs
Stas Obydionnov <stas@hellofyllo.com> writes:
> Probably I provided a bad example.
> Here is another one from a similar bug that was opened a couple of years
> ago and was not answered.

> Assuming the following query:

> SELECT ts_headline('English',
>     'This Commercial Bank does not have any Equity in Europe but European
> Commercial Bank does',
>     to_tsquery('English','European <-> Commercial <-> Bank')::tsquery);

> The returned result is:
> This <b>Commercial</b> <b>Bank</b> does not have any Equity in Europe but
> <b>European</b> <b>Commercial</b> <b>Bank</b> does

> This highlights the words Commercial & Bank separately in addition
> to European Commercial Bank.

> However, the correct output expected should be:
> This Commercial Bank does not have any Equity in Europe but <b>European</b>
> <b>Commercial</b> <b>Bank</b> does

[ shrug... ]  Whether that's more correct than the current behavior
is a matter of opinion.  As I said, the ts_headline code highlights
all matching words within whatever fragment it selects.  It does
make an effort to locate a fragment that satisfies the query as
written, but that doesn't mean there won't be additional word
matches within the fragment.  (In fact, if I'm reading the code
correctly, it actually gives preference to fragments having more
matching words, which is why you don't just get "<b>European</b>
<b>Commercial</b> <b>Bank</b>" here.)  I think it's reasonable to
consider that highlighting the additional matches is a useful thing
to do, so I'm disinclined to change this longstanding behavior.

            regards, tom lane



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

Предыдущее
От: Stas Obydionnov
Дата:
Сообщение: Re: BUG #16744: ts_headline behaves incorrectly with <-> and proximity operators
Следующее
От: Zhiyu ZY13 Xu
Дата:
Сообщение: pgadmin--pgagent---the process hang by unknow reasons