如何让 ts_headline 尊重phraseto_tsquery

ste*_*lis 5 postgresql full-text-search postgresql-9.6

我有一个使用短语搜索来匹配整个短语的查询。

SELECT ts_headline(
  'simple',
  'This is my test text. My test text has many words. Well, not THAT many words.',
  phraseto_tsquery('simple', 'text has many words')
);
Run Code Online (Sandbox Code Playgroud)

结果是:

This is my test <b>text</b>. My test <b>text</b> <b>has</b> <b>many</b> <b>words</b>. Well, not THAT <b>many</b> <b>words</b>.
Run Code Online (Sandbox Code Playgroud)

但我会预料到这一点:

This is my test text. My test <b>text</b> <b>has</b> <b>many</b> <b>words</b>. Well, not THAT many words.
Run Code Online (Sandbox Code Playgroud)

或者理想情况下甚至是这样:

This is my test text. My test <b>text has many words</b>. Well, not THAT many words.
Run Code Online (Sandbox Code Playgroud)

边注:

phraseto_tsquery('simple', 'text has many words')
Run Code Online (Sandbox Code Playgroud)

相当于

to_tsquery('simple', 'text <-> has <-> many <-> words')
Run Code Online (Sandbox Code Playgroud)

我不确定我是否做错了什么,或者 ts_headline 是否根本不支持这种突出显示。

Dip*_*hah 6

phraseto_tsquery('simple', 'text has many words')生成正确的查询,但问题似乎出在ts_headline函数上。似乎已经报告了 BUG #155172