pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Bug Report | Using ts_headline with the <-> operator
2+ messages / 2 participants
[nested] [flat]

* Bug Report | Using ts_headline with the <-> operator
@ 2021-01-20 12:37  christian@games.no
  0 siblings, 1 reply; 2+ messages in thread

From: christian@games.no @ 2021-01-20 12:37 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org

PostgreSQL version: 10.15

Operating system:   Linux/Ubuntu

 

Bug when using ts_headline with the <-> operator

 

Assuming the following query:

SELECT ts_headline('simple','The Cyberpunk launch did not go as expected for
Cyberpunk Fans around the world', phraseto_tsquery('simple','Cyberpunk
Fans')::tsquery);

 

The returned result is:

The <b>Cyberpunk</b> launch did not go as expected for <b>Cyberpunk</b>
<b>Fans</b> around the world

 

This highlights the Cyberpunk alone in addition to Cyberpunk Fans.

 

However, the expected output would be:

The Cyberpunk launch did not go as expected for <b>Cyberpunk</b> <b>Fans</b>
around the world

 

Which only highlights *Cyberpunk Fans* due to the <-> operator in
phraseto_tsquery.

 

SELECT phraseto_tsquery('simple','Cyberpunk Fans');

The above returns 'cyberpunk<-> 'fans' as expected, so presumably this is an
issue with the ts_headline function.

 

I would be great to see this fixed/improved in the near future.

 

Christian

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Bug Report | Using ts_headline with the <-> operator
@ 2021-01-20 15:38  Tom Lane <tgl@sss.pgh.pa.us>
  parent: christian@games.no
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2021-01-20 15:38 UTC (permalink / raw)
  To: christian@games.no; +Cc: pgsql-bugs@lists.postgresql.org

<christian@games.no> writes:
> Assuming the following query:

> SELECT ts_headline('simple','The Cyberpunk launch did not go as expected for
> Cyberpunk Fans around the world', phraseto_tsquery('simple','Cyberpunk
> Fans')::tsquery);

> The returned result is:

> The <b>Cyberpunk</b> launch did not go as expected for <b>Cyberpunk</b>
> <b>Fans</b> around the world

This is behaving as designed, and I don't really think it's wrong.
See previous discussion at

https://www.postgresql.org/message-id/flat/16744-861496b4f8f941f2%40postgresql.org

It is unfortunate that the only way to customize this type of decision
is to build your own new text search parser.  Perhaps someday someone
will put in the work to make that stuff a bit more modular and easier
to change.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2021-01-20 15:38 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-01-20 12:37 Bug Report | Using ts_headline with the <-> operator christian@games.no
2021-01-20 15:38 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox