sql - 如何处理 postgres 全文搜索中的 Typo 错误
问题描述
我想在 postgres 中使用全文搜索来搜索一些文本这是我的查询示例
select name, artist, texte
from testsearch
where to_tsvector(texte) @@ to_tsquery('randomname');
它只给我与 'randomname' 完全匹配的结果,我希望它也匹配 'ran' ,'rand' radom' 等......
解决方案
select name, artist, texte
from testsearch
where to_tsvector(texte) @@ to_tsquery('rand:*');
推荐阅读
- shell - 如何通过 Go 运行此命令?
- reactjs - 将日期值从父级传递给子级会导致子组件中出现奇怪的格式
- android - Android - 如何编辑按钮字符串
- google-bigquery - 如何在 BigQuery 中加入具有特定条件的表?
- c# - 基于动态条件的自动映射器
- azure-devops - azure build pipeline does not start as triggered
- google-chrome-devtools - Remove/hide accessibility info from tooltip in Chrome developer tool
- postgresql - 在 Postgres 中展开行
- html - How to remove vertical space while using display: inline with same tag or division?
- azure-logic-apps - 上一个任务失败时无法在 Azure 存储中创建文件:状态代码为“200”的操作的架构定义无效