sphinx安装步骤
1、需要mysql-devel包。
2、如无 gcc / gcc-c++包
-------------------------------------------------------------
英文版的sphinx安装
a、 ./configure --prefix=/usr/local/sphinx --with-mysql=/usr
b、 make
c、 make install
例子:
cd /usr/local/sphinx
cd etc
/usr/local/sphinx/bin/indexer --all
/usr/local/sphinx/bin/searchd
停止
/usr/local/sphinx/bin/searchd -c /usr/local/sphinx/etc/sphinx.conf --stop
/usr/local/sphinx/bin/searchd -c /usr/local/sphinx/etc/sphinx.conf --stop
sphinx-for-chinese安装
--------------------------------------------------------------------------
1、http://code.google.com/p/sphinx-for-chinese/downloads/list 下载
sphinx-for-chinese-1.10.1-dev-r2287.tar.gz
2、进行安装
tar xvzf sphinx-for-chinese-1.10.1-dev-r2287.tar.gz
cd sphinx_xxx
./configure --prefix=/usr/local/sphinx --with-mysql=/usr
make
make install
这样基本安装就好了。
3、解压分词
tar xvzf xdict_1.1.tar.gz
cd /usr/local/sphinx
cd bin
./mkdict /path/to/xdict_1.1.txt /usr/local/sphinx/etc/xdict
4、配置sphinx文档
cd /usr/local/sphinx/etc
cp sphinx.config.dist sphinx.config
vi sphinx.config
找到charset_type = utf-8
后添加
chinese_dictionary = /usr/local/sphinx/etc/xdict
5、建议简单indexer
cd /usr/local/sphinx/etc/
/usr/local/sphinx/bin/indexer --all
/usr/local/sphinx/bin/searchd
如要关闭
/usr/local/sphinx/bin/searchd -c /usr/local/sphinx/etc/sphinx.conf --stop
这样一个简单的例子就OK了
WINDOW版下的安装
------------------------------------------------------------------------------------------------------------------------------
1、到官网上下载http://www.sphinxsearch.com/downloads.html 下载win32 binaries w/mysql suppot的sphinx
0.9.9版
2、解压到window下某目录下 例如:d:\sphinx
把例子example.sql 建在mysql中。
3、安装.
d: cd sphinx
cd bin
searchd.exe --install --config d:\sphinx\sphinx.conf --servicename sphinxSearch
安装成功
4、配置sphinx.conf文件
主要有四项,source documents(源头)、index documents(源头)、indexer、searchd服务选项配置
5、建立索引
cd bin
indexer.exe --config d:\sphinx\sphinx.conf documents(源头)
6、运行sphinx进程
searchd.exe --config d:\sphinx\sphinx.conf
7、命令测试效果
search.exe -c d:\sphinx\sphinx.conf this is my