From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | stas(at)hellofyllo(dot)com |
Cc: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: BUG #16744: ts_headline behaves incorrectly with <-> and proximity operators |
Date: | 2020-11-24 18:18:10 |
Message-ID: | 292536.1606241890@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
PG Bug reporting form <noreply(at)postgresql(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | David Zhang | 2020-11-24 18:36:33 | Re: BUG #16663: DROP INDEX did not free up disk space: idle connection hold file marked as deleted |
Previous Message | PG Bug reporting form | 2020-11-24 17:02:40 | BUG #16744: ts_headline behaves incorrectly with <-> and proximity operators |