sphinx安装

分类:Sphinx | 作者:凹凸曼 | 发表于2012/02/07 sphinx安装已关闭评论

安装sphinx前,需要安装

yum -y install gcc-c++
yum -y install libtool

不然会报错

wget http://www.coreseek.cn/uploads/csft/3.2/coreseek-3.2.13.tar.gz
tar zxvf coreseek-3.2.13.tar.gz
cd coreseek-3.2.13
cd mmseg-3.2.13/
./bootstrap
./configure --prefix=/usr/local/mmseg
make && make install
cd ../csft-3.2.13/
./configure --prefix=/usr/local/sphinx --with-mysql=/usr/local/mysql/ --w
ith-mysql-includes=/usr/local/mysql/include/ --with-mysql-libs=/usr/local/mysql/
lib/ --with-mmseg=/usr/local/mmseg/ --with-mmseg-includes=/usr/local/mmseg/inclu
de/mmseg/ --with-mmseg-libs=/usr/local/mmseg/lib/
make
make install

建立索引:/usr/local/sphinx/bin/indexer –config /usr/local/sphinx/etc/sphinx.conf
test #test为索引名
启动:/usr/local/sphinx/bin/searchd –config /usr/local/sphinx/etc/sphinx.conf

php测试代码

<?php

$s =new SphinxClient;
$s->setServer("127.0.0.1",9312);
$s->setMatchMode(SPH_MATCH_ANY);
$s->setMaxQueryTime(3);
$sub=iconv('gbk','utf-8','必看');
$result =$s->query($sub,"test");
var_dump(array_keys($result['matches']));

 

相关资料:

                 http://www.coreseek.cn/news/14/52/

                http://www.banping.com/2011/03/18/sphinx-php-extension/

本文出自 “凹凸曼” 博客,请务必保留此出处   http://www.apoyl.com/?p=1305

Tag:

日志信息 »

该日志于2012-02-07 09:38由 凹凸曼 发表在Sphinx分类下, 评论已关闭。

目前盖楼

抱歉,评论被关闭

« »