- coreseek官网(http://www./)已经关闭。
- 可参考手册:https://my.oschina.net/alexwu/blog/71155
- coreseek是中文版的sphinx
搭建教程1.环境的处理 用的yum命令:
yum install make gcc g++ gcc-c++ libtool autoconf automake imake mysql-devel libxml2-devel expat-devel
用的apt-get命令:
apt-get install make gcc g++ automake libtool mysql-client libmysqlclient-dev libxml2-dev libexpat1-dev
2.软件安装常见版本:4.1,3.2.14 (建议4.1) 下载软件包 coreseek-4.1-beta.tar.gz 解压:tar zxvf coreseek-4.1-beta.tar.gz 3.安装mmseg分词 cd /usr/local/coreseek-4.1-beta
./bootstrap
./configure --prefix=/usr/local/mmseg3 #配置 mmseg-3.2.14
make && make install #编译、安装 mmseg-3.2.14
4.测试分词效果vim t1.txt
输入 中国上海,保存退出。
测试:/usr/local/mmseg3/bin/mmseg -d /usr/local/mmseg3/etc t1.txt
测试结果:
5.安装 Coreseek-4.1-beta 搜索cd /usr/local/coreseek-4.1-beta
sh buildconf.sh
./configure --prefix=/usr/local/coreseek --without-unixodbc --with-mmseg --with-mmseg-includes=/usr/local/mmseg3/include/mmseg/ --with-mmseg-libs=/usr/local/mmseg3/lib/ --without-mysql #配置 coreseek-4.1-beta
make && make install #编译、安装
索引配置######### 索引配置 ######
source baby_knowledge
{
type = mysql
sql_host = 192.168.1.1
sql_user = test
sql_pass = test
sql_db = baby //数据库名字
sql_port = 3306 //从库端口号
sql_query_pre = SET NAMES utf8
sql_query_range = SELECT MIN(id), MAX(id) FROM test
sql_range_step = 500
sql_query = \
SELECT id, title, post_id, user_id,UNIX_TIMESTAMP(dated) as dateline \
FROM test\
WHERE id>$start and id<$end
sql_attr_uint = post_id
sql_attr_uint = user_id
sql_attr_timestamp = dateline 属性字段
}
index baby_knowledge_idx //索引名
{
source = baby_knowledge
path = /usr/local/coreseek-3.2.14/ var/data/baby_knowledge //存放位置
docinfo = extern
charset_type = zh_cn.utf-8
charset_dictpath = /usr/local/coreseek-3.2.14/dict/ 要有
html_strip = 0
stopwords = /usr/local/coreseek-3.2.14/dict/stopwords/stopwords.txt //停止词
}
indexer
{
mem_limit = 128M
}
searchd
{
port = 9351 //不要被占用 netstat -anop|grep 9351
log = /usr/local/coreseek-3.2.14/ var/log/search_baby_knowledge.log
query_log = /usr/local/coreseek-3.2.14/ var/log/query_baby_knowledge.log
read_timeout = 5
max_children = 30
pid_file = /usr/local/coreseek-3.2.14/ var/searchd_baby_knowledge.pid
max_matches = 10000
seamless_rotate = 1
preopen_indexes = 0
unlink_old = 1
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
索引更新1.建立索引:/usr/local/coreseek/bin/indexer -c {最好配置文件绝对路径} {索引名字} 检查索引数据是否ok 2.启动索引服务/usr/local/coreseek/bin/searchd -c /usr/local/coreseek/etc/sphinx.conf -i baby_idx 3.查看命令用法/usr/local/coreseek/bin/search 4.直接搜索:/usr/local/coreseek/bin/search -c {最好配置文件绝对路径} {索引名字}{搜索词}
demo:搜索一个词测试 5.索引重建/usr/local/coreseek/bin/indexer --config /usr/local/coreseek/etc/project/sphinx.conf baby_idx --rotate
6.增量索引使用/usr/local/coreseek/bin/indexer --config /usr/local/coreseek/etc/project/sphinx.conf baby_merge --rotate
7.合并索引跟增量索引/usr/local/coreseek/bin/indexer --config /usr/local/coreseek/etc/project/sphinx.conf --merge baby_idx baby_merge --rotate
|