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
|
| Список | pgsql-bugs |
PG Bug reporting form <noreply@postgresql.org> 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
----------------------------------------------------------------
<b>Alpha</b> Beta <b>Gama</b> foo bar <b>alpha</b> <b>gama</b>
(1 row)
Again, this is a value judgment about what's useful.
regards, tom lane
В списке pgsql-bugs по дате отправления: