我刚刚在 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)
有人对这种行为有解释吗?