postgresql - Postgres 的全文搜索什么时候支持词组匹配和邻近匹配?

标签 postgresql full-text-search

从 Postgres 8.4 开始,数据库 fts 不支持精确短语匹配,如果给定 2 个术语,它也不支持近似匹配。例如,没有办法告诉 Postgres 匹配具有与单词 #2 指定接近度的单词 #1 的内容。有谁知道 Postgres 的计划,可能哪个版本会支持短语和邻近匹配?

最佳答案

PostgreSQL 9.6 文本搜索现在支持短语

select
  *
from (values
  ('i heart new york'),
  ('i hate york new')
) docs(body)
where
  to_tsvector(body) @@ phraseto_tsquery('new york')

(1 row retrieved)

或按单词之间的距离:

-- a distance of exactly 2 "hops" between "quick" and "fox"
select
  *
from (values
  ('the quick brown fox'),
  ('quick brown cute fox')
) docs(body)
where
  to_tsvector(body) @@ to_tsquery('quick <2> fox') 

(1 row retrieved)

关于postgresql - Postgres 的全文搜索什么时候支持词组匹配和邻近匹配?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2908712/

相关文章:

mysql - 从 PHP 序列化到 MySQL 的安全风险?

postgresql - pq : could not resize shared memory segment. 设备上没有剩余空间

postgresql - RDS Postgres 更改 SQL log_statement 值

mysql - Django 单元测试全文搜索

postgresql - Postgres - Gin 索引不起作用

mysql - 在 mysql 中为 "ft_min_word_len "FULLTEXT 设置新值

performance - postgresql:垂直分区没有带来性能提升

postgresql - 错误 : failed to connect to database: password authentication failed in Rust

postgresql - Postgresql 运算符不存在;字符=整数;

MYSQL 全文搜索和 LIKE