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

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: ngigi(at)at(dot)co(dot)ke
Subject: BUG #15172: Postgresql ts_headline with <-> operator does not highlight text properly
Date: 2018-04-25 00:02:20
Message-ID: 152461454026.19805.6310947081647212894@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message 德哥 2018-04-25 00:14:37 Re:Re: BUG #15169: create index CONCURRENTLY conflict with other table's COPY
Previous Message Tom Lane 2018-04-24 23:22:01 Re: BUG #15171: JDBC TIMESTAMP WITH TIME ZONE PSQLException When Using Substitution Parameter