postgresql中文分词插件安装
最佳答案 问答题库638位专家为你答疑解惑
1.SCWS
要使用 zhparser,首先需要安装 SCWS 分词库,SCWS 是 Simple Chinese Word Segmentation 的首字母缩写(即:简易中文分词系统)GitHub
http://www.xunsearch.com/scws/down/scws-1.2.3.tar.bz2
./configure
make install
2.Zhparser
GitHub - amutu/zhparser: zhparser is a PostgreSQL extension for full-text search of Chinese language
make && make install
遇到:pgxs.mk: 没有那个文件或目录,安装postgres-devel包
找不到pg_config:可以指定PG_CONFG=/usr/pgsql-14/bin/pg_config make
3.postgresql中文检索配置
登录postgresql
启用zhparser
插件
create extension zhparser;
创建使用zhparser
作为解析器的全文搜索的配置
-- 就是需要给zhparser解析器取一个在sql里面可以使用的名称,一下“zh”则为名称 CREATE create text search configuration chinese (parser=zhparser);
添加token映射
alter text search configuration chinese add mapping for a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z with simple;
4、全文检索使用
索引创建
create index idx_name on table_name using gin(to_tsvector('zh', field_name));
查询
SELECT * FROM table_name WHERE to_tsvector('zh', field_name) @@ 'keyword';
99%的人还看了
相似问题
- 图数据库Neo4J 中文分词查询及全文检索(建立全文索引)
- MongoDB 全文检索
- ElasticSearch 实现 全文检索 支持(PDF、TXT、Word、HTML等文件)通过 ingest-attachment 插件实现 文档的检索
- 2023年AI行业报告(附全文下载)
- mysql 全文检索 demo
- 软件开发全文档归档,开发、管理、实施、运维、服务巡检、信息安全、安全运维
- Android启动优化-全文详细
- 如何实现 Es 全文检索、高亮文本略缩处理
- Elasticsearch实现全文搜索的步骤和实现原理
- Elasticsearch(Es搜索(简单使用、全文查询、复合查询)、地理位置查询、特殊查询、聚合操作、桶聚合、管道聚合)
猜你感兴趣
版权申明
本文"postgresql中文分词插件安装":http://eshow365.cn/6-15556-0.html 内容来自互联网,请自行判断内容的正确性。如有侵权请联系我们,立即删除!