实战coreseek/sphnix,初探中文分词环境配置

环境:

操作系统:ubuntu 

coreseek:3.2

目的:对phpcms添加全文索引功能。

官方文档:http://www.coreseek.cn/docs/coreseek_3.2-sphinx_0.9.9.html 

------------------------------

进入coreseek的目录下进行安装:
/usr/local/src/coreseek-3.2.14/csft-3.2.14


./configure --prefix=/var/lib/coreseek --with-mysql=/var/lib/mysql --with-mmseg=/var/lib/mmseg --with-mmseg-includes=/var/lib/mmseg/include/mmseg/ --with-mmseg-libs=/var/lib/mmseg/lib/
 
make && make install

 

这里的安装跟上面sphinx一样的,就是加入了LibMMseg分词,安装完创建测试数据,
创建搜索配置文件csft.conf,过程跟安装测试sphinx一样,但是创建索引时报了一个这样的错误:
FATAL: index 'test1': 'synonyms': failed to open '/data/exceptions.txt',
进入配置文件csft.conf,把/data/exceptions.txt注释掉即可,创建完索引,运行测试OK。
 
要进行中文分词搜索请在配置文件中加入

修改charset_type= zh_cn.utf-8
 charset_dictpath = /var/lib/mmseg/etc/

在示例配置文件中,将试图对MySQL数据库test中的 documents 表建立索引;因此在这里还提供了 example.sql 用于给测试表增加少量数据用于测试:

$ mysql -u test < /usr/local/coreseek/etc/example.sql

注意修改数据库的编码为utf-8.并且插入中文记录来测试。关于csft.conf配置文件的解释  可参考:http://wenku.baidu.com/view/1774e0efe009581b6bd9eb3c.html

 

另外说明:我用SerureCRT 来远程连接ubuntu操作的,在显示问方面会有乱码问题,用vm的ssh连接就没问题。

 

测试:

$ /opt/coreseek/bin/search 我爱鸡冠花

index 'test1stemmed': query '我爱鸡冠花 ': returned 0 matches of 0 total in 0.000 sec

words:
1. '我': 2 documents, 2 hits
2. '爱': 0 documents, 0 hits
3. '鸡冠花': 0 documents, 0 hits

分词成功。

 

转载于:https://www.cnblogs.com/ikodota/archive/2012/05/04/install-coreseek-mmseg.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值