首页 > 代码库 > 【编译打包】sphinx-for-chinese-2.2.1-r4311.el6.src.rpm

【编译打包】sphinx-for-chinese-2.2.1-r4311.el6.src.rpm

sphinx 由于中文分词效果不佳,于是就有国内牛人给它改装了,sphinx-for-chinese 就是其中一个。


本包集成了字典,初始化时需要生成字典,务必检查字典源文件是utf-8格式的,见下文。


环境CentOS 6 X64


安装步骤

yum install yum-utils -y
rpm -ivh sphinx-for-chinese-2.2.1-r4311.el6.src.rpm
yum-builddep ~/rpmbuild/SPECS/sphinx-for-chinese.spec
rpmbuild -ba ~/rpmbuild/SPECS/sphinx-for-chinese.spec
rpm -ivh ~/rpmbuild/RPMS/x86_64/sphinx-for-chinese-2.2.1-r4311.el6.x86_64.rpm

准备字典

yum install dos2unix -y
cd /etc/xdict
tarzxvf xdict_1.1.tar.gz
dos2unix xdict_1.1.txt
/usr/bin/mkdict xdict_1.1.txt xdict


确保在/etc/sphinx/sphinx.conf 的index 段中包含下面三行配置

charset_type   = utf-8
chinese_dictionary = /etc/xdict/xdict
ngram_len = 1


附件有点大,超过了博客附件限制,请移步百度网盘下载

http://pan.baidu.com/s/1c08dWFQ


其他配置,参见官方

http://www.sphinx-search.com/

本文出自 “专注Linux 运维” 博客,请务必保留此出处http://purplegrape.blog.51cto.com/1330104/1581342

【编译打包】sphinx-for-chinese-2.2.1-r4311.el6.src.rpm