全文搜索不会显示某些词汇的任何值。
虽然这段代码返回true
:
SELECT to_tsvector('ispell_russian', description)
@@ to_tsquery('ispell_russian', 'сам')
FROM callcenter.points_cardsservices
INNER JOIN callcenter.units ON recipientname = name
WHERE units.deptid = 5
AND id=366020;
以下选择的结果为空:
SELECT *
FROM callcenter.points_cardsservices
INNER JOIN callcenter.units ON recipientname = name
WHERE units.deptid = 5
AND id=366020
AND to_tsvector('ispell_russian', description)
@@ to_tsquery('ispell_russian', 'сам');
我正在搜索的单词曾经是一个停用词列表。它会引起这种问题吗?此外,to_tsvector('ispell_russian', description)
有一个索引。
你永远不会找到一个禁用词,因为在搜索开始之前就会被过滤掉。
但你说它曾经是一个禁忌词。如果您更改了停用词列表,则更改了在索引中使用的IMMUTABLE
(!)函数to_tsvector('ispell_russian', $1)
的行为。
如果更改索引不可变函数的行为,则索引将损坏。您将不得不使用REINDEX INDEX
来重建索引。