ITeye博客

ubuntu910下安装coreseek中文全文索引

hipeace87 · 2010-03-10 16:53 · 数据库 · Markdown

先下载(**表示版本号)

csft**.tar.gz

mmseg**.tar.gz

放到/root目录下

解压

tar -xzvf csft**.tar.gz
tar -xzvf mmseg**.tar.gz

编译mmseg 安装

cd mmseg*
sudo ./configure --prefix=/usr/local/mmseg
sudo make
sudo make install             

 

错误提示为:css/UnigramCorpusReader.cpp:89: error: 'strncmp' was not declared in this scope
手动修改了src/css/UnigramCorpusReader.cpp
在上面添加了一句

#include <string.h>

cd csf*
sudo ./configure --prefix=/usr/local/coreseek --with-python --with-mysql --with-mmseg-includes=/usr/local/mmseg/include/mmseg --with-mmseg-libs=/usr/local/mmseg/lib/

 

没找到mysql
原来是没装mysql dev

sudo apt-get install libmysqlclient15-dev

修改/usr/local/mmseg/include/mmseg/freelist.h这个文件,在上面添加

#include <string.h>

安装完成

cd /usr/local/coreseek/etc
sudo cp sphinx.conf.dist csft.conf
sudo gedit csft.conf

 

现在加入中文搜索的设置

首先,复制mmseg中的data文件夹到你的mmseg的安装目录中,当然,可以不这么做,但是我希望是将有联系的东西放在一起便于查找

sudo cp /root/mmseg**/data/  /usr/local/mmseg/ -R

这里可以根据你的情况设定具体的路径

然后进入刚才的路径,生成字典文件。

cd /usr/local/mmseg/data

运行以下命令生成字典

sudo /usr/local/mmseg/bin/mmseg -u unigram.txt

会生成一个unigram.txt.uni文件,将这个文件改名或者复制为uni.lib在当前文件夹

sudo cp unigram.txt.uni uni.lib

ok,字典弄好了

现在修改csft.conf文件

sudo gedit /usr/local/coreseek/etc/csft.conf

  查找charset_type并修改为charset_type   = zh_cn.utf-8同时添加一行charset_dictpath  = /usr/local/mmseg/data
保存退出,现在向默认的mysql数据库中插入一条中文信息。注意需要utf8_general_ci编码
重建索引

sudo /usr/local/coreseek/bin/indexer --all

好了,现在可以正常查询了,并且返回的也是正常的中文信息。测试一下

sudo /usr/local/coreseek/bin/search 中文测试

呵呵,ok了。。

评论(1)

  1. #1 楼 · kqy929 · 2010-03-23 13:49

    Hi,非常感谢你这篇文章,照你说的,我也部署好coreseek. 测试发现,soreseek对词分得还可以。 但是, 例如:“中文测试” 2 hits 但使用“中”进行测试时, 0 hits 怎么整合单个字呢?

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