小编Mic*_*ael的帖子

Postgres ts_headline 不一致的行为

我刚刚在 postgres ts_headline 函数(用于突出显示全文搜索结果)中偶然发现了一个奇怪的行为。首先,我认为简单的字典不能突出显示,如下例所示(应该有<b>标签):

# SELECT ts_headline('simple', 'This is artificial text', to_tsquery('artificial'));
       ts_headline       
-------------------------
 This is artificial text
(1 row)
Run Code Online (Sandbox Code Playgroud)

但是换个词就好了……

# SELECT ts_headline('simple', 'some Word in', to_tsquery('Word'));
 ts_headline     
---------------------
 some <b>Word</b> in
(1 row)
Run Code Online (Sandbox Code Playgroud)

有人对这种行为有解释吗?

postgresql full-text-search

6
推荐指数
1
解决办法
746
查看次数

标签 统计

full-text-search ×1

postgresql ×1