Coreseek安装-带中文分词的Sphinx

什么是Coreseek

Sphinx默认不支持中文索引及检索,基于Sphinx开发了Coreseek全文检索服务器,Coreseek应该是现在用的最多的Sphinx中文全文检索,它提供了为Sphinx设计的中文分词包LibMMSeg包含mmseg中文分词。

安装
1.先安装环境

yum install make gcc gcc++ gcc-c++ libtool autoconf automake imake mysql-devel libxml2-devel expat-devel

注: 检测以上软件是否安装,如果没有请确保安装;否则无法正常安装Coreseek-3.2.14
2、开始安装:

cd /usr/local/src     #把安装包放到此处

wget http://www.coreseek.cn/uploads/csft/3.2/coreseek-3.2.14.tar.gz        #下载CoreSeek,这里注意一下,这个路径现在暂时已经用不了(至少我写这篇博客的时候用不了),但是毕竟这是官网,还是要放一下的。我的网盘中有该软件 http://url.cn/2I77CON ,大家可以先下载到本地,然后再用 Filezilla 等软件上传到服务器即可。

tar -zxvf coreseek-3.2.14.tar.gz

cd coreseek-3.2.14  #解压出来的文件夹

##############安装 mmseg #################

cd mmseg-3.2.14

./bootstrap        #输出的warning信息可以忽略,如果出现error则需要解决,一般不会出现错误

./configure --prefix=/usr/local/mmseg3  #指定 mmseg 的安装目录

make && make install


#############安装 csft-3.2.14 ###############

cd /usr/local/src/csft-3.2.14

#这里我们要修改 src/sphinxexpr.cpp 文件,将该文件中的 1013、1047、1080 行的 ExprEval 改为 this->ExprEval(这里的行数跟网上的教程说的行数不一样,可能是版本的问题吧,但是如果你用的是我提供的版本,该行数是正确的),懂点 C++ 的同学也可以自己看看 ExprEval 错在哪里。

#改完上面所说的问题后:
sh buildconf.sh

./configure --prefix=/usr/local/coreseek  --without-unixodbc --with-mmseg --with-mmseg-includes=/usr/local/mmseg3/include/mmseg/ --with-mmseg-libs=/usr/local/mmseg3/lib/ --with-mysql

make && make install



cd csft-4.1

sh buildconf.sh

可能报错:
automake: warnings are treated as errors

此时,修改configure.ac
vim configure.ac
13行 >>>
AM_INIT_AUTOMAKE([-Wall -Werror foreign]) 改为
AM_INIT_AUTOMAKE([-Wall foreign]) subdir-objects
保存退出
libsphinx.a(sphinx.o): In function CSphTokenizer_zh_CN_GBK::GetLocalBuffer(unsigned char*, int, unsigned char*)': /setup/coreseek-3.2.14/csft-3.2.14/src/sphinx.cpp:4764: undefined reference tolibiconv’
libsphinx.a(sphinx.o): In function CSphTokenizer_zh_CN_UTF8_Private::GetConverterOutput(char const*, char const*)': /setup/coreseek-3.2.14/csft-3.2.14/src/tokenizer_zhcn.h:86: undefined reference tolibiconv_open’
/setup/coreseek-3.2.14/csft-3.2.14/src/tokenizer_zhcn.h:89: undefined reference to libiconv' libsphinx.a(sphinx.o): In functionCSphTokenizer_zh_CN_GBK::SetBuffer(unsigned char*, int)’:
/setup/coreseek-3.2.14/csft-3.2.14/src/sphinx.cpp:4792: undefined reference to libiconv' libsphinx.a(sphinx.o): In functionCSphTokenizer_zh_CN_UTF8_Private::GetConverter(char const*, char const*)’:
/setup/coreseek-3.2.14/csft-3.2.14/src/tokenizer_zhcn.h:70: undefined reference to libiconv_open' /setup/coreseek-3.2.14/csft-3.2.14/src/tokenizer_zhcn.h:73: undefined reference tolibiconv’
libsphinx.a(sphinx.o): In function xmlUnknownEncoding': /setup/coreseek-3.2.14/csft-3.2.14/src/sphinx.cpp:20719: undefined reference tolibiconv_open’
/setup/coreseek-3.2.14/csft-3.2.14/src/sphinx.cpp:20737: undefined reference to libiconv' /setup/coreseek-3.2.14/csft-3.2.14/src/sphinx.cpp:20743: undefined reference tolibiconv_close’
collect2: ld 返回 1
make[2]: *** [indexer] 错误 1
make[2]: Leaving directory /setup/coreseek-3.2.14/csft-3.2.14/src' make[1]: *** [all] 错误 2 make[1]: Leaving directory/setup/coreseek-3.2.14/csft-3.2.14/src’
make: *** [all-recursive] 错误 1

解决
一开始以为libiconv的问题,又重装了几次还是一样,最后终于找着办法了
编辑:
./src/MakeFile文件

LIBS = -lm -lexpat -L/usr/local/lib
改成
LIBS = -lm -lexpat -liconv -L/usr/local/lib

猜你喜欢

转载自blog.csdn.net/qq_16059847/article/details/82981366