postgresql - Postgres 全文搜索 : Phrase Operator (<x>) distance is looking for an exact distance match

标签 postgresql amazon-web-services full-text-search amazon-rds tsvector

当使用短语运算符( <X> )语法进行全文搜索时,它并没有像我期望的那样“小于或等于”数字。搜索值必须正好位于那么多位置之外。

给出这个例子:

select *
from (values
  ('bob is really smart, isn''t he?')
) docs(body)
where
  to_tsvector(body) @@ to_tsquery('simple', 'bob <3> smart');

使用<3>返回匹配项。但是,任何其他较大的值(即 <4><5> )都不匹配。

Postgres 中是否有一些配置设置可以使用领带战斗机?

我正在 AWS 上使用 RDS Postgres 实例:PostgreSQL 9.6.11 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.3 20140911 (Red Hat 4.8.3-9), 64-bit

最佳答案

事实证明它按预期运行。 :/

曾经有一个AROUND(X)函数的功能符合我的预期(小于或等于),但看起来它在某个时候已从 Postgres 中删除。

有一些可用的补丁可以创建 <X, Y>语法,其中 X是最小距离,Y是最大距离。这些在 AWS 上的 RDS 实例上下文中不可行。

关于postgresql - Postgres 全文搜索 : Phrase Operator (<x>) distance is looking for an exact distance match,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59146600/

相关文章:

amazon-web-services - Maven 无法从链中的任何提供商加载 AWS 凭证

Mysql全文搜索不区分大小写

mysql - 忽略查询中的mysql全文停用词

sql - 从指定数据库获取表大小

mysql - 扩展 OLTP 解决方案

amazon-web-services - 域名如何用于亚马逊在 ACM 中颁发的 SSL 证书

mysql - 带有 SphinxSE 的 MariaDB 10.0

sql - 如何在特定事件之前对组中的事件进行计数

sql - 选择成二维数组

amazon-web-services - 无法创建Fargate个人资料