ITeye博客

搭建sphinx中文检索引擎

gengshu1111 · 2010-12-22 23:16 · Linux · 操作系统 · Markdown

前一段在研究sphinx,检索功能很强大,用的ubuntu,coreseek中文检索

用root账户登录

1、 ubuntu9.10需安装软件:


apt-get install gcc g++ automake libtool mysql-client libmysqlclient15-dev   libxml2-dev libexpat1-dev 

2、 下载coreseek:


download http://www.coreseek.cn/uploads/csft/3.2/coreseek-3.2.13.tar.gz
tar xzvf coreseek-3.2.13.tar.gz

3、 安装mmseg中文分词:


cd mmseg-3.2.13
./bootstrap
##ubuntu环境下,需要使用ACLOCAL_FLAGS="-I /usr/share/aclocal" ./bootstrap
./configure --prefix=/usr/local/mmseg3
make
make install

检测安装:


/usr/local/mmseg3/bin/mmseg -d /usr/local/mmseg3/etc src/t1.txt

中文/x 分/x 词/x 测试/x 中国人/x 上海市/x

Word Splite took: 1 ms.

4、 安装coreseek(mysql数据源):


cd csft-3.2.13
sh buildconf.sh
apt-get install mysql-client libmysqlclient15-dev   libxml2-dev libexpat1-dev
./configure --prefix=/usr/local/coreseek --with-mmseg --with-mmseg-includes=/usr/local/mmseg3/include/mmseg/ --with-mmseg-libs=/usr/local/mmseg3/lib/ --with-mysql
make
make install

5、 测试安装:


/usr/local/coreseek/bin/indexer -c /usr/local/coreseek/etc/sphinx-min.conf.dist

6、 建立全索引:


/usr/local/coreseek/bin/indexer -c /usr/local/coreseek/etc/csft.conf --all

搜索:


/usr/local/coreseek/bin/search -c /usr/local/coreseek/etc/csft.con
f

开启searchd端口监控:


/usr/local/coreseek/bin/searchd -c  /usr/local/coreseek/etc/csft.conf

关闭端口:


/usr/local/coreseek/bin/searchd -c /usr/local/coreseek/etc/csft.conf --stop

重建索引


/usr/local/coreseek/bin/indexer -c /usr/local/coreseek/etc/csft.conf --all --rotate

建立指定配置文件中指定索引


/usr/local/coreseek/bin/indexer -c /usr/local/coreseek/etc/csft.conf index1 --rotate

7、配置中文分词 生成词典: cp ~/mmseg3/data/ /usr/local/mmseg/ -R /usr/local/mmseg3/bin/mmseg -u unigram.txt cp unigram.txt.uni uni.lib

修改索引配置:


charset_dictpath=/usr/local/mmseg3/etc/
charset_type=zh_cn.utf-8

重建索引加入cron任务, 建立增量索引, 配置文件等等 再续..

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。