2

ts_headline() does not seem to highlight the input text in a way that respects the <-> operator.

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);

returns the following as output:

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 and Bank separately in addition to the phrase European Commercial Bank.

The expected output would 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 <-> operators inserted by phraseto_tsquery().

I am using Postgres 10.3 on Linux x64. Any suggestions or solutions to this problem?

I reported a bug.

  • I think that's a shortcoming of ts_headline(), which has not been extended to cover the new phrase search in pg 9.6. Ah, I see you filed a bug report - which should be mentioned in your question: postgresql.org/message-id/flat/… – Erwin Brandstetter Apr 25 '18 at 2:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.