Sphinx安装

Coreseek 是一款中文全文检索/搜索软件,以GPLv2许可协议开源发布,基于Sphinx研发并独立发布,专攻中文搜索和信息处理领域,适用于行业/垂直搜索、论坛/站内搜索、数据库搜索、文档/文献检索、信息检索、数据挖掘等应用场景,
http://www.coreseek.cn/

yum -y install gcc gcc-c++ autoconf python python-devel libiconv
yum -y install glibc

iconv 是内建 glibc 的组成部分,所以没有独立出 shared-library。

至于 mcrypt 没有收录在 centos 内。若是需要的话,建议抓 fedora 提供的 source rpm package 来 rebuild 一份成为 binary rpm package 使用即可。
这个需要找时间学习一下啊

下载coreseek:coreseek 3.2.14
wget http://www.coreseek.cn/uploads/csft/3.2/coreseek-3.2.14.tar.gz
tar zxvf coreseek-3.2.14.tar.gz
cd coreseek-3.2.14
cd mmseg-3.2.14/
./bootstrap

#输出的warning信息可以忽略,如果出现error则需要解决
./configure –prefix=/usr/local/mmseg3
make && make install
cd ..
cd coreseek-3.2.14
cd csft-3.2.14
./configure –prefix=/usr/local/coreseek –without-python –without-unixodbc –with-mmseg –with-mmseg-includes=/usr/local/mmseg3/include/mmseg/ –with-mmseg-libs=/usr/local/mmseg3/lib/ –with-mysql
make && make install

##配置测试,测试是否可以正确运行
/usr/local/coreseek/bin/indexer -c /usr/local/coreseek/etc/sphinx-min.conf.dist
##以下为正常测试时的提示信息:
Coreseek Fulltext 3.2 [ Sphinx 0.9.9-release (r2117)]
Copyright (c) 2007-2010,
Beijing Choice Software Technologies Inc (http://www.coreseek.com)

using config file ‘/usr/local/coreseek/etc/sphinx-min.conf.dist’…
total 0 reads, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg
total 0 writes, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg
数据源支持:支持MySQL数据源
##完成后:提供mysql数据源支持和xml数据源支持
##系统需要安装相关的基础依赖库,否则无法支持对应的功能
yum install mysql-devel libxml2-devel expat-devel
先检查一下 有就不需要再更新
rpm -qa |grep mysql
mysql-server-5.1.44-1.el5.remi
mod_auth_mysql-3.0.0-3.2.el5_3
php-mysql-5.3.2-1.el5.remi
mysqlclient15-5.0.67-1.el5.remi
libdbi-dbd-mysql-0.8.1a-1.2.2
mysql-libs-5.1.44-1.el5.remi
mysql-devel-5.1.44-1.el5.remi
mysql-bench-5.1.44-1.el5.remi
mysql-connector-odbc-3.51.26r1127-1.el5
mysql-5.1.44-1.el5.remi
rpm -qa |grep libxml2
libxml2-devel-2.6.26-2.1.2.8
libxml2-python-2.6.26-2.1.2.8
libxml2-2.6.26-2.1.2.8
rpm -qa |grep expat-devel
expat-devel-1.95.8-8.2.1

cd csft-3.2.14
make clean
./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
make && make install
coreseek中文全文检索测试

$ cd testpack
$  /usr/local/coreseek/bin/indexer -c etc/csft.conf
##以下为正常情况下的提示信息:
Coreseek Fulltext 3.2 [ Sphinx 0.9.9-release (r2117)]
Copyright (c) 2007-2010,
Beijing Choice Software Technologies Inc (http://www.coreseek.com)

using config file ‘etc/csft.conf’…
total 0 reads, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg
total 0 writes, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg
##
##csft-4.0版显示:ERROR: nothing to do.
##
$  /usr/local/coreseek/bin/indexer -c etc/csft.conf –all
##以下为正常索引全部数据时的提示信息:(csft-4.0版类似)
Coreseek Fulltext 3.2 [ Sphinx 0.9.9-release (r2117)]
Copyright (c) 2007-2010,
Beijing Choice Software Technologies Inc (http://www.coreseek.com)

using config file ‘etc/csft.conf’…
indexing index ‘xml’…
collected 3 docs, 0.0 MB
sorted 0.0 Mhits, 100.0% done
total 3 docs, 7585 bytes
total 0.075 sec, 101043 bytes/sec, 39.96 docs/sec
total 2 reads, 0.000 sec, 5.6 kb/call avg, 0.0 msec/call avg
total 7 writes, 0.000 sec, 3.9 kb/call avg, 0.0 msec/call avg

$  /usr/local/coreseek/bin/indexer -c etc/csft.conf xml
##以下为正常索引指定数据时的提示信息:(csft-4.0版类似)
Coreseek Fulltext 3.2 [ Sphinx 0.9.9-release (r2117)]
Copyright (c) 2007-2010,
Beijing Choice Software Technologies Inc (http://www.coreseek.com)

using config file ‘etc/csft.conf’…
indexing index ‘xml’…
collected 3 docs, 0.0 MB
sorted 0.0 Mhits, 100.0% done
total 3 docs, 7585 bytes
total 0.069 sec, 109614 bytes/sec, 43.35 docs/sec
total 2 reads, 0.000 sec, 5.6 kb/call avg, 0.0 msec/call avg
total 7 writes, 0.000 sec, 3.9 kb/call avg, 0.0 msec/call avg

$  /usr/local/coreseek/bin/search -c etc/csft.conf
##以下为正常测试搜索时的提示信息:(csft-4.0版类似)
Coreseek Fulltext 3.2 [ Sphinx 0.9.9-release (r2117)]
Copyright (c) 2007-2010,
Beijing Choice Software Technologies Inc (http://www.coreseek.com)

using config file ‘etc/csft.conf’…
index ‘xml’: query ”: returned 3 matches of 3 total in 0.093 sec

displaying matches:
1. document=1, weight=1, published=Thu Apr  1 22:20:07 2010, author_id=1
2. document=2, weight=1, published=Thu Apr  1 23:25:48 2010, author_id=1
3. document=3, weight=1, published=Thu Apr  1 12:01:00 2010, author_id=2

words:
$  /usr/local/coreseek/bin/search -c etc/csft.conf -a Twittter和Opera都提供了搜索服务
##以下为正常测试搜索关键词时的提示信息:(csft-4.0版类似)
Coreseek Fulltext 3.2 [ Sphinx 0.9.9-release (r2117)]
Copyright (c) 2007-2010,
Beijing Choice Software Technologies Inc (http://www.coreseek.com)

using config file ‘etc/csft.conf’…
index ‘xml’: query ‘Twittter和Opera都提供了搜索服务 ‘: returned 3 matches of 3 total in 0.038 sec

displaying matches:
1. document=3, weight=24, published=Thu Apr  1 12:01:00 2010, author_id=2
2. document=1, weight=4, published=Thu Apr  1 22:20:07 2010, author_id=1
3. document=2, weight=3, published=Thu Apr  1 23:25:48 2010, author_id=1

words:
1. ‘twittter’: 1 documents, 3 hits
2. ‘和’: 3 documents, 15 hits
3. ‘opera’: 1 documents, 25 hits
4. ‘都’: 2 documents, 4 hits
5. ‘提供’: 0 documents, 0 hits
6. ‘了’: 3 documents, 18 hits
7. ‘搜索’: 2 documents, 5 hits
8. ‘服务’: 1 documents, 1 hits

$  /usr/local/coreseek/bin/searchd -c /usr/local/coreseek/etc/csft.conf
##以下为正常开启搜索服务时的提示信息:(csft-4.0版类似)
Coreseek Fulltext 3.2 [ Sphinx 0.9.9-release (r2117)]
Copyright (c) 2007-2010,
Beijing Choice Software Technologies Inc (http://www.coreseek.com)

using config file ‘etc/csft.conf’…
listening on all interfaces, port=9312
##如要停止搜索服务,请使用/usr/local/coreseek/bin/searchd -c /usr/local/coreseek/etc/csft.conf –stop
##如要已启动服务,要更新索引,请使用/usr/local/coreseek/bin/indexer -c /usr/local/coreseek/etc/csft.conf –all –rotate

##然后,请参考csft-3.2.14下api目录中的相关文件,使用PHP、Python、Ruby、Java来测试搜索服务;也可以前往< ahref=”/products-install/step_by_step/”>搜索服务建立三步曲,查看第三步使用PHP测试。

##四、继续
##通过以上步骤,coreseek已经安装测试完成,可以提供正常的xml数据源索引以及提供对应的搜索服务了
##下一步工作,请查看手册,准备好mysql数据信息,以及进行mysql数据源的测试,并在您的应用中调用搜索服务;mysql数据源的配置可参考testpack/etc/csft_mysql.conf文件

##先启动搜索服务
/usr/local/coreseek/bin/searchd -c /usr/local/coreseek/etc/csft.conf
##如要停止搜索服务
/usr/local/coreseek/bin/searchd -c /usr/local/coreseek/etc/csft.conf –stop
##在已启动服务情况下,要更新索引,
/usr/local/coreseek/bin/indexer -c /usr/local/coreseek/etc/csft.conf –all –rotate
每个人不同安装路劲的估计不一样,再议再议

加入自动计划中:
crontab -e
# Incremental Index posts data
* 0-3 * * * root /usr/local/coreseek/bin/indexer –config /usr/local/coreseek/etc/csft.conf posts_minute –rotate
* 6-23 * * * root /usr/local/coreseek/bin/indexer –config /usr/local/coreseek/etc/csft.conf posts_minute –rotate
0 4 * * * root /usr/local/coreseek/bin/indexer –config /usr/local/coreseek/etc/csft.conf posts_merge –rotate && /usr/local/coreseek/bin/indexer –config /usr/local/coreseek/etc/csft.conf –merge posts posts_merge –rotate

# Incremental Index threads data
* 0-3 * * * root /usr/local/coreseek/bin/indexer –config /usr/local/coreseek/etc/csft.conf threads_minute –rotate
* 6-23 * * * root /usr/local/coreseek/bin/indexer –config /usr/local/coreseek/etc/csft.conf threads_minute –rotate
0 4 * * * root /usr/local/coreseek/bin/indexer –config /usr/local/coreseek/etc/csft.conf threads_merge –rotate && /usr/local/coreseek/bin/indexer –config /usr/local/coreseek/etc/csft.conf –merge threads threads_merge –rotate#
参考:
http://www.coreseek.cn/products/products-install/install_on_bsd_linux/
http://hi.baidu.com/c618/blog/item/c7d5b38fbc4ba6cef01f362e.html

留下评论