Re: BUG #15172: Postgresql ts_headline with <-> operator does not highlight text properly

From: Alex Malek <magicagent(at)gmail(dot)com>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: ngigi(at)at(dot)co(dot)ke
Subject: Re: BUG #15172: Postgresql ts_headline with <-> operator does not highlight text properly
Date: 2022-08-03 18:02:51
Message-ID: CAGH8cccS-9yb1VkgUTAaghz4P3aL8DneH_24bN7Y0LCLO8by1Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

I can confirm this is still an issue in PostgreSQL 14.4

Best,
Alex

On Wed, Aug 3, 2022 at 1:58 PM PG Bug reporting form <noreply(at)postgresql(dot)org>
wrote:

> The following bug has been logged on the website:
>
> Bug reference: 15172
> Logged by: Ngigi Waithaka
> Email address: ngigi(at)at(dot)co(dot)ke
> PostgreSQL version: 10.3
> Operating system: Linux
> Description:
>
> I have a noticed a likely bug when using ts_headline with the <-> operator
>
> Assuming the following query:
>
> SELECT ts_headline('English','This Commercial Bank does not have any Equity
> in Europe but European Commercial Bank does',
> phraseto_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
>
> Which only highlights *European Commercial Bank* due to the <-> operator in
> phraseto_tsquery.
>
> SELECT phraseto_tsquery('English','European Commercial Bank');
> returns 'european' <-> 'commerci' <-> 'bank' as expected indicating the
> problem is with ts_headline function.
>
> Regards
> NgigiW
>
>

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Poornima Venkatesan 2022-08-03 19:17:51 Re: BUG #17567: Unable to Set Max_Connection in Postgresql which has replicas
Previous Message PG Bug reporting form 2022-08-03 17:51:10 BUG #17569: false negative / positive results when using <-> (followed by) and tsvector limit (16383) hit