gpt4 book ai didi

postgresql - 如何让 ts_headline 尊重phraseto_tsquery

转载 作者:行者123 更新时间:2023-12-03 16:40:57 24 4
gpt4 key购买 nike

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

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

结果是:
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>.

但我会预料到这一点:
This is my test text. My test <b>text</b> <b>has</b> <b>many</b> <b>words</b>. Well, not THAT many words.

或者理想情况下甚至是这样:
This is my test text. My test <b>text has many words</b>. Well, not THAT many words.

边注:
phraseto_tsquery('simple', 'text has many words')

相当于
to_tsquery('simple', 'text <-> has <-> many <-> words')

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

最佳答案

phraseto_tsquery('simple', 'text has many words')生成正确的查询,但问题似乎出在 ts_headline功能。好像是已经报告的BUG #155172 .

关于postgresql - 如何让 ts_headline 尊重phraseto_tsquery,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49495941/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com