Coreseek 是一个支持中文的全文搜索引擎,意图为其他应用提供高速、低空间占用、高结果相关度的中文全文搜索能力。Coreseek 可以非常容易的与 SQL 数据库和脚本语言集成。基于 Sphinx 搜索工具编写的中文全文搜索引擎,适用于 Windows / Linux / FreeBSD 等多个平台。

注意:Coreseek 目前已经没有任何团队维护了,官网已经失效,也就是说后期如果有什么问题是得不到任何帮助的,只能阅读留下来的 API 文档自己解决,文章末尾附加了一些资源和文件。
为您的应用实施全文检索,您可以:
1、下载 Coreseek 并将名字命名为 coreseek,找到 coreseek/etc/csft_mysql.conf,把文件 csft_mysql.conf 配置成如下:
#源定义
source magnet{
type = mysql
sql_host = localhost
sql_user = root
sql_pass = root
sql_db = magnet
sql_port = 3306
sql_query_pre = SET NAMES utf8
sql_query =SELECT id, creation_date, name as title, (SELECT GROUP_CONCAT(file.file SEPARATOR ',') FROM file, magnet_file WHERE file.id = magnet_file.file_id and magnet_file.magnet_id = magnet.id) as content, '1' as data_type FROM magnet
sql_attr_uint = data_type
sql_attr_timestamp = creation_date
sql_query_info_pre = SET NAMES utf8
sql_query_info = SELECT * FROM magnet WHERE id = $id
}
#index定义
index magnet{
source = magnet
path = D:/Dpan/coreseek/var/magnet
docinfo = extern
mlock = 0
morphology = none
min_word_len = 1
html_strip = 0
charset_dictpath = D:/Dpan/coreseek/etc/
charset_type = zh_cn.utf-8
}
#全局index定义
indexer{
mem_limit = 128M
}
#searchd服务定义
searchd{
listen = 9312
read_timeout = 5
max_children = 30
max_matches = 1000
seamless_rotate = 0
preopen_indexes = 0
unlink_old = 1
pid_file = D:/Dpan/coreseek/var/log/searchd_mysql.pid
log = D:\Dpan/coreseek/var/log/searchd_mysql.log
query_log = D:/Dpan/coreseek/var/log/query_mysql.log
}
上面的目录你可以根据自己的具体目录地址修改。
2、安装 searchd 服务,打开 cmd 命令窗口并执行下面命令:
D:\Dpan\coreseek\bin\searchd.exe --install --config D:/Dpan/coreseek/etc/csft_mysql.conf
csft_mysql.conf 就是刚刚我们的配置文件,将 searchd 安装成为一个服务,安装成功后命令行窗口会提示 services searchd installed successfully。
3、建立索引
D:\Dpan\coreseek\bin\indexer -c D:\Dpan\coreseek\etc\csft_mysql.conf --all
csft_mysql.conf 就是刚刚我们的配置文件。
4、在 PHP 中使用 coreseek 搜索,在 API 目录下面有很多的使用例子,各个语言都可以调用 coreseek 的搜索,这里以 PHP 为例。
require ( "sphinxapi.php" );
$cl = new SphinxClient ();
$cl->SetServer ( '127.0.0.1', 9312);
$cl->SetConnectTimeout ( 3 );
$cl->SetArrayResult ( true );
$cl->SetMatchMode ( SPH_MATCH_ANY);
$res = $cl->Query ( '黑', "*" );
print_r($cl);
print_r($res);

