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
292536.1606241890@sss.pgh.pa.us
Ответ на
Список
Дерево обсуждения
BUG #16744: ts_headline behaves incorrectly with <-> and proximity operators PG Bug reporting form <noreply@postgresql.org>
Re: BUG #16744: ts_headline behaves incorrectly with <-> and proximity operators Tom Lane <tgl@sss.pgh.pa.us>
Re: BUG #16744: ts_headline behaves incorrectly with <-> and proximity operators Stas Obydionnov <stas@hellofyllo.com>
Re: BUG #16744: ts_headline behaves incorrectly with <-> and proximity operators Tom Lane <tgl@sss.pgh.pa.us>
PG Bug reporting form  writes:
> When running the following code
>     select ts_headline('Alpha Beta Gama', phraseto_tsquery ('alpha gama'))
> or 
>     select ts_headline('Alpha Beta Gama', to_tsquery ('alpha <-> gama'))
> I would expect the result be not to be highlighted,

That's operating as designed, I think.  Per the code comment:

         * If we found nothing acceptable, select min_words words starting at
         * the beginning.

The expectation really is that it's on you to not select documents that
don't match your search query.  Once you've selected a document to
display, ts_headline() is just going to do the best it can to produce
something useful.  "Not highlight anything" wasn't deemed particularly
useful, and I agree with that judgment.

Also, once it's selected a document fragment to display, it will highlight
all words within that fragment that appear in the search query, whether or
not the particular occurrence is part of the match-if-any.  Thus

regression=# select ts_headline('Alpha Beta Gama foo bar alpha gama', phraseto_tsquery ('alpha gama'));
                          ts_headline                           
----------------------------------------------------------------
 Alpha Beta Gama foo bar alpha gama
(1 row)

Again, this is a value judgment about what's useful.

			regards, tom lane


В списке pgsql-bugs по дате отправления
От: PG Bug reporting form
Дата:
От: Maxim Boguk
Дата:
FAQ