【问题标题】:PostgreSQL full-text search drops rows from selectionPostgreSQL 全文搜索从选择中删除行
【发布时间】:2019-04-24 07:50:24
【问题描述】:

全文搜索不按某些词位显示任何值。

虽然这段代码返回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) 上有一个索引。

【问题讨论】:

    标签: postgresql full-text-search database-indexes


    【解决方案1】:

    你永远找不到停用词,因为它在搜索开始之前就被过滤掉了。

    但你说它曾经是一个停用词。如果您更改了停用词列表,则您已经更改了您在索引中使用的 IMMUTABLE (!) 函数 to_tsvector('ispell_russian', $1) 的行为。

    如果您更改索引不可变函数的行为,则索引会损坏。您必须使用REINDEX INDEX 来重建索引。

    【讨论】:

      猜你喜欢
      • 2011-04-29
      • 1970-01-01
      • 2013-03-09
      • 2012-08-23
      • 1970-01-01
      • 2013-12-06
      • 1970-01-01
      • 1970-01-01
      • 2016-06-18
      相关资源
      最近更新 更多