sphinx-for-chinese中文安装

sphinx-for-chinese是一款专注于中文搜索的全文检索软件,在sphinx的基础上添加了中文处理模块并优化了中文搜索效果。

1,下载:

wget http://www.sphinx-search.com/downloads/sphinx-for-chinese-2.2.1-dev-r4311.tar.gz

wget https://sphinx-for-chinese.googlecode.com/files/xdict_1.1.tar.gz


2,安装

tar &&cd && ./configure --prefix=/usr/local/sphinx-for-chinese --with-mysql 编译mysql支持

make && make install


3,配置中文支持

tar -zxvf xdict_1.1.tar.gz


/usr/local/sphinx-for-chinese/bin/mkdict xdict_1.1.txt xdict

从xdict_1.1.txt生成xdict文件,xdict_1.1.txt文件可以根据需要修改


cp xdict /usr/local/sphinx-for-chinese/etc/


4,修改sphinx.conf索引配置文件


在index索引配置项中添加

charset_type = utf-8

chinese_dictionary = /usr/local/sphinx-for-chinese/etc/xdict


5,导入测试数据

mysql -usphinx -psphinx < /usr/local/sphinx/etc/example.sql


6,建立索引

/usr/local/sphinx-for-chinese/bin/indexer --all --rotate

如果sphinx在运行中,要indexer时,需要加上--rotate参数,这样索引完就直接生效了。


7,测试

/usr/local/sphinx-for-chinese/bin/search  我


8,启动与关闭

/usr/local/sphinx-for-chinese/bin/searchd -c /usr/local/sphinx-for-chinese/etc/sphinx.conf

/usr/local/sphinx-for-chinese/bin/searchd -c /usr/local/sphinx-for-chinese/etc/sphinx.conf  --stop

你可能感兴趣的:(sphinx,xdict)