首页 > 解决方案 > 如何处理 postgres 全文搜索中的 Typo 错误

问题描述

我想在 postgres 中使用全文搜索来搜索一些文本这是我的查询示例

select name, artist, texte
from testsearch
where to_tsvector(texte) @@ to_tsquery('randomname');

它只给我与 'randomname' 完全匹配的结果,我希望它也匹配 'ran' ,'rand' radom' 等......

标签: sqlpostgresqlfull-text-search

解决方案


select name, artist, texte
from testsearch
where to_tsvector(texte) @@ to_tsquery('rand:*');

推荐阅读