本文主要是介绍coreseek搭建教程,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
说明
- coreseek官网(http://www.coreseek.cn/)已经关闭。
- 可参考手册: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.14make && 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 = mysqlsql_host = 192.168.1.1sql_user = testsql_pass = testsql_db = baby //数据库名字sql_port = 3306 //从库端口号sql_query_pre = SET NAMES utf8sql_query_range = SELECT MIN(id), MAX(id) FROM testsql_range_step = 500sql_query = \SELECT id, title, post_id, user_id,UNIX_TIMESTAMP(dated) as dateline \FROM test\WHERE id>$start and id<$endsql_attr_uint = post_idsql_attr_uint = user_idsql_attr_timestamp = dateline 属性字段
}
index baby_knowledge_idx //索引名
{source = baby_knowledgepath = /usr/local/coreseek-3.2.14/ var/data/baby_knowledge //存放位置docinfo = externcharset_type = zh_cn.utf-8charset_dictpath = /usr/local/coreseek-3.2.14/dict/ 要有html_strip = 0stopwords = /usr/local/coreseek-3.2.14/dict/stopwords/stopwords.txt //停止词
}
indexer
{mem_limit = 128M
}
searchd
{port = 9351 //不要被占用 netstat -anop|grep 9351log = /usr/local/coreseek-3.2.14/ var/log/search_baby_knowledge.logquery_log = /usr/local/coreseek-3.2.14/ var/log/query_baby_knowledge.logread_timeout = 5max_children = 30pid_file = /usr/local/coreseek-3.2.14/ var/searchd_baby_knowledge.pidmax_matches = 10000seamless_rotate = 1preopen_indexes = 0unlink_old = 1
}
索引更新
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
这篇关于coreseek搭建教程的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!