最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 科技 - 知识百科 - 正文

sphinx/coreseek安装

来源:动视网 责编:小采 时间:2020-11-09 13:20:46
文档

sphinx/coreseek安装

sphinx/coreseek安装:Sphinx 官方版本安装 wget http://sphinxsearch.com/files/sphinx-2.0.3-release.tar.gz tar zxvf sphinx-2.0.3-release.tar.gz ./configure prefix=/usr/local/sphinx with-mysql make make insta
推荐度:
导读sphinx/coreseek安装:Sphinx 官方版本安装 wget http://sphinxsearch.com/files/sphinx-2.0.3-release.tar.gz tar zxvf sphinx-2.0.3-release.tar.gz ./configure prefix=/usr/local/sphinx with-mysql make make insta


Sphinx 官方版本安装 wget http://sphinxsearch.com/files/sphinx-2.0.3-release.tar.gz tar zxvf sphinx-2.0.3-release.tar.gz ./configure prefix=/usr/local/sphinx with-mysql make make install cd /usr/local/sphinx cp etc/sphinx-min.conf.dist etc/

Sphinx 官方版本安装
wget http://sphinxsearch.com/files/sphinx-2.0.3-release.tar.gz
tar zxvf sphinx-2.0.3-release.tar.gz
./configure –prefix=/usr/local/sphinx –with-mysql
make && make install
cd /usr/local/sphinx
cp etc/sphinx-min.conf.dist etc/sphinx.conf
测试数据库,新建test数据库,导入etc/example.sql做测试
#修改mysql帐户密码
vim etc/sphinx.conf
#建立索引
bin/indexer -c etc/sphinx.conf test1
#查询
bin/search -c etc/sphinx.conf test
#开启守护进程
bin/searchd -c etc/sphinx.conf


但是官方不支持中文分词,硬伤……
支持中文方案:
1. 安装 Sphinx-For-Chinese
wget http://sphinx-for-chinese.googlecode.com/files/sphinx-for-chinese-2.1.0-dev-r3361.tar.bz2
tar -xvf sphinx-for-chinese-2.0.2-dev-r24.tar.gz
$ cd sphinx-for-chinese-2.0.2-dev-r24
$ ./configure –prefix=/usr/local/sphinx-for-chinese
–prefix 指定安装路径
–with-mysql 编译mysql支持
–with-pgsql 编译pgsql支持
$ make
$ make install

配置中文支持
wget http://sphinx-for-chinese.googlecode.com/files/xdict_1.1.tar.gz
$ tar -xvf xdict_1.1.tar.gz
$ /usr/local/sphinx-for-chinese/bin/mkdict xdict_1.1.txt xdict #从xdict_1.1.txt生成xdict文件,xdict_1.1.txt文件可以根据需要进行修改
$ cp xdict /usr/local/sphinx-for-chinese/etc/

修改sphinx.conf索引配置文件,在索引配置项中添加以下两项
charset_type = utf-8
chinese_dictionary = /usr/local/sphinx-for-chinese/etc/xdict

2. 按照Coreseek
具体参照: http://www.coreseek.cn/products-install/install_on_bsd_linux/
$ wget http://www.coreseek.cn/uploads/csft/4.0/coreseek-4.1-beta.tar.gz
$ tar xzvf coreseek-4.1-beta.tar.gz
$ cd coreseek-4.1-beta/mmseg-3.2.14/
$ ./bootstrap #输出的warning信息可以忽略,如果出现error则需要解决
$ ./configure –prefix=/usr/local/mmseg3
$ make && make install
$ cd ..

##安装coreseek
$ cd csft-3.2.14 或者 cd csft-4.0.1 或者 cd csft-4.1
$ sh buildconf.sh #输出的warning信息可以忽略,如果出现error则需要解决
$ ./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 ##如果提示mysql问题,可以查看MySQL数据源安装说明
$ make && make install
$ cd ..

PHP安装sphinx扩展
#先安装sphinxclient
cd sphinx-2.0.3-release/api/libsphinxclient
vim sphinxclient.c
#找到 void sock_close ( int sock );
改为 static void sock_close ( int sock );
./configure –prefix=/usr/local/sphinxclient
make && make install

wget http://pecl.php.com/get/sphinx-1.3.0.tgz
tar zxvf sphinx-1.3.0.tgz
cd sphinx-1.3.0
/usr/local/php/bin/phpize
./configure –with-php-config=/usr/local/php/bin/php-config –with-sphinx=/usr/local/sphinxclient
make && make install

在php.ini加入sphinx.so

这里最后选择Coreseek
更新索引,可以放在Crontab中执行,每天自动更新
/usr/local/coreseek/bin/indexer –rotate -c /usr/local/coreseek/etc/sphinx.conf –all

文档

sphinx/coreseek安装

sphinx/coreseek安装:Sphinx 官方版本安装 wget http://sphinxsearch.com/files/sphinx-2.0.3-release.tar.gz tar zxvf sphinx-2.0.3-release.tar.gz ./configure prefix=/usr/local/sphinx with-mysql make make insta
推荐度:
标签: 安装 官方
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top