在Posgres中,全文索引允许对文档进行预处理,并保存索引以供以后快速搜索.预处理包括:
将文档解析为令牌.
将代词转换为词素.
存储为搜索而优化的预处理文档.
tsvector
类型用于Postgres的全文搜索
tsvector
型与text
型在以下方面不同:
消除了这种情况.大写/小写字母相同
删除停止词(和,或,不是,她,他和其他数百人)-因为这些词与文本搜索无关
Replaces synonyms and takes word stems (
elephant
->eleph
). In the full text catalogue, it does not have the wordelephant
but the wordelep
.可以(也应该)用GIST和GIN索引
使用权重和;
ts_rank
在Postgres中,Elastic search (搜索引擎)如何优于全文搜索?