Sphinx coreseek中文全文搜索

Sphinx coreseek中文全文搜索

Sphinx是一个基于SQL的全文检索引擎,可以结合MySQL,PostgreSQL做全文搜索,它可以提供比数据库本身更专业的搜索功能,使得应用程序更容易实现专业化的全文检索。Sphinx特别为一些脚本语言设计搜索API接口,如PHP,Python,Perl,Ruby等,同时为MySQL也设计了一个存储引擎插件。

什么是coreseek?

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

Coreseek全文搜索服务器的主要特性包括:支持多种数据来源、高性能、支持复杂的查询、中文优化、支持作为MySQL的存储引擎

PHP+MySQL+Sphinx架构

php_mysql_sphinx
php_mysql_sphinx

 

  • Ubuntu Kyln 14.04 x86_64
1.软件安装
sudo apt-get install make gcc g++ automake libtool m4 autoconf mysql-client libmysqlclient15-dev libxml2-dev libexpat1-dev
1.下载coreseek,解压
2.安装mmseg
./bootstrap
./configure –prefix=/usr/local/mmseg
sudo make && make install
3.安装csft
sh buildconf.sh
sudo ./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
sudo make && make install
4.cd testpack
像使用sphinx一样使用coreseek

  • CentOS 6.5 Linux bogon 2.6.32-431.el6.x86_64
1.下载coreseek
2.解压
tar xvzf coreseek-3.2.13.tar.gz
3.安装依赖软件
sudo yum install gcc gcc-c++ libtool autoconf automake imake mysql-devel libxml2-devel expat-devel
4.安装mmsge分词软件
cd coreseek-3.2.13/mmseg-3.2.14/
sudo ./bootstrap
sudo ./configure –prefix=/usr/local/mmseg
sudo make && make install
分词测试
mmseg -d /usr/local/etc testpack/var/test/test.xml
coreseek_mmseg_test
5.安装csft
cd coreseek-3.2.14/csft-3.2.14/
sudo ./buildconf.sh
sudo ./configure –prefix=/usr/local/coreseek –without-unixodbc –with-mmseg –with-mmseg-includes=/usr/local/include/mmseg/ –with-mmseg-libs=/usr/local/lib/ –with-mysql
sudo make && make install
===================================
导入测试数据到test数据库
coreseek-3.2.14/testpack/var/test/documents.sql
复制,修改配置文件
sudo cp coreseek-3.2.14/testpack/etc/csft_mysql.conf /usr/local/coreseek/etc/csft.conf
sudo vim /usr/local/coreseek/etc/csft.conf
—————————–
path            = /usr/local/coreseek/var/data/mysql
charset_dictpath = /usr/local/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
—————————–
创建索引
sudo /usr/local/coreseek/bin/indexer -c /usr/local/coreseek/etc/csft.conf –all
搜索测试
sudo /usr/local/coreseek/bin/search -c /usr/local/coreseek/etc/csft.conf 移动
coreseek_search
启动服务
sudo /usr/local/coreseek/bin/searchd -c /usr/local/coreseek/etc/csft.conf
php测试
cd coreseek-3.2.14/testpack/api
php test.php 移动平台
coreseek_search_php