Windows下Coreseek4.1环境搭建及运行(提供压缩包地址
很遗憾,coreseek官网因未知原因打不开了。貌似也不是短时间的事情,难道是开发者放弃coreseek了?
闲话少说,笔者在搭建完sphinx后,因为中文分词的原因总觉得美中不足,于是千方百计的找到了coreseek的win32安装包。
下载后解压到相应目录,我这里安装的是在F:/coreseek下。so下面凡是涉及到路径的地方一定要注意修改哦!
下载解压后,把F:/coreseek/etc/csft_mysql.conf 这个文件复制一份到F:/coreseek/bin下面,并且命名为coreseek.conf,然后修改配置文件里面的相关信息。相对于sphinx的配置文件,coreseek.conf还是简单易懂的。
#MySQL数据源配置,详情请查看:http://www.coreseek.cn/products-install/mysql/
#请先将var/test/documents.sql导入数据库,并配置好以下的MySQL用户密码数据库
#源定义
source mysql
{
type = mysql
sql_host = localhost
sql_user = root
sql_pass = root
sql_db = sphinxtest
sql_port = 3306
sql_query_pre = SET NAMES utf8
sql_query = SELECT id, group_id, UNIX_TIMESTAMP(date_added) AS date_added, title, content FROM documents
#sql_query第一列id需为整数
#title、content作为字符串/文本字段,被全文索引
#从SQL读取到的值必须为整数
sql_attr_uint = group_id
#从SQL读取到的值必须为整数,作为时间属性
sql_attr_timestamp = date_added
#命令行查询时,设置正确的字符集
sql_query_info_pre = SET NAMES utf8
#命令行查询时,从数据库读取原始数据信息
sql_query_info = SELECT * FROM documents WHERE id=$id
}
#index定义
index mysql
{
#对应的source名称
source = mysql
#请修改为实际使用的绝对路径,例如:/usr/local/coreseek/var/...
path = F:/coreseek/var/data/mysql
docinfo = extern
mlock = 0
morphology = none
min_word_len = 1
html_strip = 0
#中文分词配置,详情请查看:http://www.coreseek.cn/products-install/coreseek_mmseg/
#charset_dictpath = /usr/local/mmseg3/etc/ #BSD、Linux环境下设置,/符号结尾
#Windows环境下设置,/符号结尾,最好给出绝对路径,例如:C:/usr/local/coreseek/etc/...
charset_dictpath = F:/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 = F:/coreseek/var/log/searchd_mysql.pid #请修改为实际使用的绝对路径,例如:/usr/local/coreseek/var/...
log = F:/coreseek/var/log/searchd_mysql.log #请修改为实际使用的绝对路径,例如:/usr/local/coreseek/var/...
query_log = F:/coreseek/var/log/query_mysql.log #请修改为实际使用的绝对路径,例如:/usr/local/coreseek/var/...
binlog_path = #关闭binlog日志
}
准备数据库:
DROP TABLE IF EXISTS documents; CREATE TABLE documents ( id INTEGER PRIMARY KEY NOT NULL AUTO_INCREMENT, group_id INTEGER NOT NULL, group_id2 INTEGER NOT NULL, date_added DATETIME NOT NULL, title VARCHAR(255) NOT NULL, content TEXT NOT NULL ); REPLACE INTO documents ( id, group_id, group_id2, date_added, title, content ) VALUES ( 1, 1, 5, NOW(), 'test one', 'this is my test document number one. also checking search within phrases.' ), ( 2, 1, 6, NOW(), 'test two', 'this is my test document number two' ), ( 3, 2, 7, NOW(), 'another doc', 'this is another group' ), ( 4, 2, 8, NOW(), 'doc number four', 'this is to test groups' ); DROP TABLE IF EXISTS tags; CREATE TABLE tags ( docid INTEGER NOT NULL, tagid INTEGER NOT NULL, UNIQUE(docid,tagid) ); INSERT INTO tags VALUES (1,1), (1,3), (1,5), (1,7), (2,6), (2,4), (2,2), (3,15), (4,7), (4,40);
配置完成安装下面操作即可:
1.点击开始按钮输入cmd ,右键cmd.exe 以管理员身份运行
2.安装coreseek
F:/coreseek/bin/searchd --install --config F:/coreseek/bin/coreseek.conf --servicename Coreseek
并启动 Coreseek 服务
sc start Coreseek
3.如要已启动服务,要更新索引
F:/coreseek/bin/indexer -c F:/coreseek/bin/coreseek.conf --all --rotate
4.开启coreseek命令
F:/coreseek/bin/searchd -c F:/coreseek/bin/coreseek.conf
操作完成后打开搜索页面测试就可以了
卸载 coreseek
停止服务
sc stop Coreseek
卸载服务 sc delete Coreseek