centos 下 sphinx(coreseek)安装及常见问题
前期准备:
libtool-2.4.2.tar.gz 、 autoconf-2.64.tar.bz2 、 automake-1.11.2.tar.gz 、 coreseek-3.2.14.tar.gz
开始安装
安装运行所需编译环境(-y是安装的时候不需确认)
yum -y install glibc make gcc g++ gcc-c++ libtool autoconf automake imake mysql-devel libxml2-devel expat-devel清除以前的autoconf
yum erase autoconf安装libtool
tar zxvf libtool-2.4.2.tar.gz
./configure
make
make install安装autoconf
tar jxvf autoconf-2.64.tar.bz2
cd autoconf-2.64
./configure
make
make install安装automake
tar xzvf automake-1.11.tar.gz
cd automake-1.11
./configure
make
make install安装mmseg、csft (这两个软件在coreseek文件里)
tar zxvf coreseek-3.2.14.tar.gz
cd coreseek-3.2.14先安装mmseg (安装过程不出现error就算成功)
cd mmseg-3.2.14
./bootstrap
./configure –prefix=/usr/local/mmseg
make && make install安装coreseek
cd csft-3.2.14
sh buildconf.sh
./configure –prefix=/usr/local/coreseek –without-unixodbc –with-mmseg –with-mmseg-includes=/usr/local/mmseg/include/mmseg/ –with-mmseg-libs=/usr/local/mmseg/lib/ –with-mysql
make && make install可能出现的问题
sphinxexpr.cpp:1047:43: error: ‘ExprEval’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]出现这个提示只需要找到csft-3.2.14/src/sphinxexpr.cpp 的 1047行,将ExprEval修改为this->ExprEval之后重新执行 make && make install 即可
测试mmseg分词和coreseek搜索
备注:需要预先设置好字符集为zh_CN.UTF-8,确保正确显示中文。
运行locale保证如下设置
LANG=zh_CN.UTF-8
LC_ALL=”zh_CN.UTF-8”配置测试
/usr/local/coreseek/bin/indexer -c /usr/local/coreseek/etc/sphinx-min.conf.dist
cd testpack
cat var/test/test.xml #窗口应该正确显示中文,如果出现乱码,请设置好字符集
/usr/local/mmseg/bin/mmseg -d /usr/local/mmseg/etc var/test/test.xml/usr/local/coreseek/bin/indexer -c etc/csft.conf –all
如果出现文件不存在
使用命令 find / -name csft.conf 找到文件位置,并将 etc/csft.conf 替换成查询到的位置如果出现Unigram dictionary load Error
编辑 csft.conf 文件,搜索 charset_dictpath ,修改为charset_dictpath = /usr/local/mmseg/etc//usr/local/coreseek/bin/search -c etc/csft.conf 自由缩放
出现如上图所示结果则表示成功参考文档
Sphinx中文指南
http://www.sphinxsearch.org/sphinx-tutorialSphinx中文分词应用
http://www.sphinxsearch.org/archives/82