六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 921|回复: 0

sphinx的coreseek4.0中文分词的安装

[复制链接]
 楼主| 发表于 2016-2-25 15:12:51 | 显示全部楼层 |阅读模式
sphinx的coreseek4.0中文分词的安装
                        http://www.coreseek.cn/forum/index.html

远程访问的php代码,一定要保存文本为utf-8,不然查询不了中文
文件-》另存为 格式 utf-8
1.yum install glibc make gcc g++ gcc-c++ libtool autoconfautomake imake mysql-devel libxml2-devel expat-devel

2.
运行locale保证如下设置
LANG=zh_CN.UTF-8
LC_ALL="zh_CN.UTF-8"

3.
先清除以往autoconf
yum erase autoconf


卸载后会发现libtool也被卸载了,会出现如下错误
configure.in:26: error: possibly undefined macro:AM_PROG_LIBTOOL
     If this token and others are legitimate, please usem4_pattern_allow.
     See the Autoconf documentation.
解决办法:     
wget http://mirror.bjtu.edu.cn/gnu/libtool/libtool-2.4.2.tar.gz
./configure
make
make install

4.
tar xzvf autoconf-2.64.tar.gz
cd autoconf-2.64
./configure
make
make install
tar xzvf automake-1.11.2.tar.gz
cd automake-1.11.2
./configure
make
make install

5.
下载coreseek
wget http://www.coreseek.cn/uploads/csft/3.2/coreseek-4.1-beta.tar.gz
tar zxvf coreseek-4.1-beta.tar.gz
cd coreseek-4.1-beta

6.
安装mmseg
cd mmseg-3.2.14
./bootstrap   #输出的warning信息可以忽略,如果出现error则需要解决
./configure --prefix=/usr/local/mmseg
make && make install

7.
安装coreseek
cd csft-4.1
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
此时先修改文件
vim src/Makefile

LIBS = -ldl -lm -lz -lexpat  -L/usr/local/lib-lrt  -lpthread
变成
LIBS = -ldl -lm -lz -lexpat -liconv -L/usr/local/lib -lrt  -lpthread
make && make install

8.
##测试mmseg分词,coreseek搜索(需要预先设置好字符集为zh_CN.UTF-8,确保正确显示中文)
cd testpack
catvar/test/test.xml   #此时应该正确显示中文
/usr/local/mmseg/bin/mmseg -d/usr/local/mmseg/etc/ /home/software/server/coreseek-4.1-beta/mmseg-3.2.14/src/t1.txt
/usr/local/mmseg/bin/mmseg -d /usr/local/mmseg/etc//home/software/server/coreseek-4.1-beta/testpack/var/test/test.xml
/usr/local/coreseek/bin/indexer -c/usr/local/coreseek/etc/sphinx-min.conf.dist
csft-4.0 版显示:ERROR: nothing to do.
若发现错误
error while loading shared libraries:libiconv.so.2: cannot open shared object file: No such file ordirectory
解决方式
cd /etc
ln -s /usr/local/lib/libiconv.so.2 /usr/lib/libiconv.so.2
ldconfig

9.
配置mysql,导入测试数据
create database test;
mysql -uroot -proot test </home/software/server/coreseek-4.1-beta/testpack/var/test/documents.sql
quit
cp/home/software/server/coreseek-4.1-beta/testpack/etc/csft_mysql.conf/usr/local/coreseek/etc/

10.
mkdir /usr/local/coreseek/var/data/
配置csft_mysql.conf文件
vim /usr/local/coreseek/etc/csft_mysql.conf
  sql_user               = root
  sql_pass               =
  path            = /usr/local/coreseek/var/data/mysql
   charset_dictpath =/usr/local/mmseg/etc/
   
pid_file = /usr/local/coreseek/var/log/searchd_mysql.pid
log = /usr/local/coreseek/var/log/searchd_mysql.log
query_log = /usr/local/coreseek/var/log/query_mysql.log

11.启动sphinx搜索
/usr/local/coreseek/bin/indexer -c/usr/local/coreseek/etc/csft_mysql.conf --all
/usr/local/coreseek/bin/searchd -c/usr/local/coreseek/etc/csft_mysql.conf
如果报错
WARNING: index 'mysql': preload: failed to open var/data/mysql.sph:No such file or directory; NOT SERVING
FATAL: no valid indexes to serve
解决
新建立索引
/usr/local/coreseek/bin/indexer -c/usr/local/coreseek/etc/csft_mysql.conf --all
更改
mysql的问题 stock路径问题,需要在my.cnf更改 /var/lib/mysql/mysql.sock
vim /etc/my.cnf
#socket        = /tmp/mysql.sock
socket         = /var/lib/mysql/mysql.sock

防火墙问题  关闭防火墙

9.
启动
/usr/local/coreseek/bin/indexer -c/usr/local/coreseek/etc/csft_mysql.conf --all
/usr/local/coreseek/bin/searchd -c/usr/local/coreseek/etc/csft_mysql.conf

10.保证跨机器访问,关闭防火墙
service iptables stop
                                                                       
http://blog.sina.com.cn/s/blog_53b95aec01010fhp.html
sphinx的coreseek4.0中文分词的安装

该会员没有填写今日想说内容.
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表