使用 Postgresql 的 GIN 或 GiST 索引时是否有内置的方法来突出显示匹配的搜索关键字?或者如果没有,有一种在 Postgresql 之外执行此操作的方法吗?
我使用的是 PHP 5.3.10 和 Postgresql 9.1.3。
所有想法都会受到赞赏。
最佳答案
查看 ts_headline 函数 ts_headline .
SELECT ts_headline('english',
'The most common type of search
is to find all documents containing given query terms
and return them in order of their similarity to the
query.',
to_tsquery('query & similarity'));
ts_headline
------------------------------------------------------------
containing given <b>query</b> terms
and return them in order of their <b>similarity</b> to the
<b>query</b>.
关于postgresql - 使用 Postgresql GIN/GiST 突出显示搜索结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10782365/