coreseek实战(一):windows下coreseek的安装与测试
coreseek实战(一):windows下coreseek的安装与测试
网上关于 coreseek 在 windows 下安装与使用的教程有很多,官方也有详细的教程,这里我也只是按着官方提供的教程详细的动手操作一遍,加深印象。官方页面见:http://www.coreseek.cn/products-install/install_on_windows/
第一步:下载coreseek 3.2.14 for windows,并安装
1、下载后解压得到源程序目录 coreseek-3.2.14-win32 ,文件夹重命名一下,简单一些,命名为 coreseek;
2、将 coreseek 文件夹移动到 d:\www\ 下(根据你个人爱好,放哪都可以);
3、“开始”——>“运行”——>输入cmd,打开命令行窗口——>执行 "d: 回车"——>执行 "cd www\coreseek\",进入到 coreseek目录下;
4、执行 "set PATH=%CD%\bin;%PATH%"。设置path,目的是为了能够调用bin目录下的 cat.exe、iconv.exe 等;
5、将 searchd 安装成为一个服务。执行 "bin\searchd --install --config d:/www/coreseek/etc/csft_mysql.conf",安装成功后命令行窗口会提示" services searchd installed successfully"。注意两点:
(1)、win7下命令行窗口需要以管理员身份运行,否则会出现”fatal openscmanager“错误而无法安装
(2)、如果不把 searchd 安装成为服务,那每次使用 coreseek 全文搜索,都得在命令行窗口打开 searchd 服务且不可关闭或停止(命令行窗口不需要开启,使用api接口时需要)
-----第5点2013.2.7号修正,以上为错误的------
首先,需要配置好 index索引后,才可以安装成为一个服务,所以,这点放在这是错误的;
其次,是补充一点,无法正常安装,或安装后启动该服务时出现1067错误,很有可能是路径问题:一是需要注意数据源配置文件里全部使用绝对路径;二是上面的 install命令,也需要使用绝对路径,而且路径用 '/' ,不能是 '\'。
第二步:mysql数据源的配置与创建索引文件
1、配置 mysql 数据源及测试(在 coreseek\etc\csft_mysql.conf 文件)
说明:这里我没有使用 coreseek 自带的document.sql,而是使用了 我自己本身已有的一个数据库数据,关于 csft_mysql.conf 配置文件中的各个配置项,我们在后面的文章中会做测试与学习,具体参考官方 coreseek 3.2 / sphinx 0.9.9 中文手册。

#MySQL数据源配置,详情请查看:http://www.coreseek.cn/products-install/mysql/
#请先将var/test/documents.sql导入数据库,并配置好以下的MySQL用户密码数据库 #源定义
source weibo
{
type = mysql
sql_host = localhost
sql_user = root
sql_pass = 123456
sql_db = weibo
sql_port = 3306
sql_query_pre = SET NAMES utf8 sql_query = SELECT id, title, content FROM weibo #sql_query第一列id需为整数
#title、content作为字符串/文本字段,被全文索引
sql_attr_uint = group_id #从SQL读取到的值必须为整数
sql_attr_timestamp = date_added #从SQL读取到的值必须为整数,作为时间属性 sql_query_info_pre = SET NAMES utf8 #命令行查询时,设置正确的字符集
sql_query_info = SELECT * FROM documents WHERE id=$id #命令行查询时,从数据库读取原始数据信息
} #index定义
index weibo
{
source = weibo #对应的source名称
path = var/data/mysql #请修改为实际使用的绝对路径,例如:/usr/local/coreseek/var/...
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环境下设置,/符号结尾
charset_dictpath = d:/www/coreseek/etc/ #Windows环境下设置,/符号结尾,最好给出绝对路径,例如:C:/usr/local/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 = var/log/searchd_mysql.pid #请修改为实际使用的绝对路径,例如:/usr/local/coreseek/var/...
log = var/log/searchd_mysql.log #请修改为实际使用的绝对路径,例如:/usr/local/coreseek/var/...
query_log = var/log/query_mysql.log #请修改为实际使用的绝对路径,例如:/usr/local/coreseek/var/...
}

2、创建索引
在命令行窗口下执行 " bin\indexer -c etc\csft_mysql.conf weibo",即:创建名为weibo的数据源的索引。如果需要创建 csft_mysql.conf 配置文件中的所有索引,刚使用 --all 替代 weibo。

D:\www\coreseek>bin\indexer -c etc\csft_mysql.conf weibo
Coreseek Fulltext 3.2 [ Sphinx 0.9.9-release (r2117)]
Copyright (c) 2007-2011,
Beijing Choice Software Technologies Inc (http://www.coreseek using config file 'etc\csft_mysql.conf'...
indexing index 'weibo'...
collected 8 docs, 0.0 MB
sorted 0.0 Mhits, 100.0% done
total 8 docs, 1381 bytes
total 0.188 sec, 7319 bytes/sec, 42.40 docs/sec
total 2 reads, 0.000 sec, 1.2 kb/call avg, 0.0 msec/call avg
total 7 writes, 0.000 sec, 0.9 kb/call avg, 0.1 msec/call avg

此时,在 coreseek\var\data 下发现,生成6个文件。
第三步:数据测试(命令行下不需要开启 searchd 服务)
1、测试搜索中文。命令 为“ echo 搜索的词 | iconv -f gbk -t utf-8 | search -c etc\csft_mysql.conf --stdin | iconv -f utf-8 -t gbk ”

D:\www\coreseek>echo 生意 | iconv -f gbk -t utf-8 | search -c etc\csft_mysql.con
f --stdin | iconv -f utf-8 -t gbk
Coreseek Fulltext 3.2 [ Sphinx 0.9.9-release (r2117)]
Copyright (c) 2007-2011,
Beijing Choice Software Technologies Inc (http://www.coreseek.com) using config file 'etc\csft_mysql.conf'...
index 'weibo': query '生意
': returned 1 matches of 1 total in 0.013 sec displaying matches:
1. document=2, weight=1, hit=22, dates=Thu Jan 01 08:33:32 1970
id=2
title=队照排货照炒 百度生意照做
content=他还告诉记者,如果顾客在他们店购买iPhone5,iPhone4S的回收价格可
以再往上浮动300元左右,记者随后咨询了另外几家手机店,发现回收价格基本在1500元至2
000元之间
hit=22
dates=2012-10-01 words:
1. '生意': 1 documents, 1 hits

2、搜索英文,出现乱码是正常的。命令为” bin\search -c etc\csft_mysql.conf 搜索词“

D:\www\coreseek>bin\search -c etc\csft_mysql.conf emall
Coreseek Fulltext 3.2 [ Sphinx 0.9.9-release (r2117)]
Copyright (c) 2007-2011,
Beijing Choice Software Technologies Inc (http://www.coreseek.com) using config file 'etc\csft_mysql.conf'...
index 'weibo': query 'emall ': returned 2 matches of 2 total in 0.013 sec displaying matches:
1. document=8, weight=2, hit=0, dates=Thu Jan 01 08:33:32 1970
id=8
title=emall鐢靛瓙鍟嗗煄
content=绁濊春emall鍟嗗煄鎴愮珛
hit=0
dates=2012-12-01
2. document=9, weight=2, hit=0, dates=Thu Jan 01 08:33:32 1970
id=9
title=emall鐢靛瓙鍟嗗煄
content=绁濊春emall鍟嗗煄鎴愮珛
hit=0
dates=2012-12-01 words:
1. 'emall': 2 documents, 4 hits

coreseek实战(一):windows下coreseek的安装与测试的更多相关文章
- Windows下的Memcache安装与测试教程
Windows下的Memcache安装 1.下载memcache for windows. 下载地址:http://splinedancer.com/memcached-win32/,推荐下载bina ...
- 最实用windows 下python+numpy安装(转载)
最实用windows 下python+numpy安装 如题,今天兜兜转转找了很多网站帖子,一个个环节击破,最后装好费了不少时间. 希望这个帖子能帮助有需要的人,教你一篇帖子搞定python+numpy ...
- Windows下的Memcache安装 linux下的Memcache安装
linux下的Memcache安装: 1. 下载 memcache的linux版本,注意 memcached 用 libevent 来作事件驱动,所以要先安装有 libevent. 官方网址:http ...
- Windows下的Memcache安装
Windows下的Memcache安装: 1. 下载memcache的windows稳定版,解压放某个盘下面,比如在c:\memcached2. 在终端(也即cmd命令界面)下输入 'c:\memca ...
- Windows下 VM12虚拟机安装OS X 10.11 和VM TOOLS
Windows下虚拟机安装Mac OS X —– VMware Workstation12安装Mac OS X 10.11 本文即将介绍WIN虚拟MAC的教程.完整详细教程(包含安装中的一些问题) [ ...
- Windows下Memcache的安装与在php中使用
memcache dll插件和测试例子下载地址: http://pecl.php.net/package/memcache Windows下Memcache的安装方法 Memcached官方:http ...
- Mysql在windows下的免安装配置步骤和重新安装的步骤
windows下mysql免安装配置 1. 下载mysql免安装压缩包 下载mysql-5.6.22-winx64.zip 解压到本地D:\mysql-5.6.22-winx64 2. 修改配置文件 ...
- DEDECMS最新5.7版在Windows下的Memcache安装
一,织梦后台后台设置进入系统后台,在[系统基本参数]下面的"性能选项"卡当中,关于memcache进行如下配置: cfg_memcache_enable : 是否启用memcach ...
- Windows下的Memcache安装:
Windows下的Memcache安装:1. 下载memcache的windows稳定版,解压放某个盘下面,比如在c:\memcached2. 在终端(也即cmd命令界面)下输入 'c:\memcac ...
随机推荐
- List<T>线性查找和二分查找BinarySearch效率分析
今天因为要用到List的查找功能,所以写了一段测试代码,测试线性查找和二分查找的性能差距,以决定选择哪种查找方式. 线性查找:Contains,Find,IndexOf都是线性查找. 二分查找:Bin ...
- Perl Sort函数用法总结和使用实例
一) sort函数用法 sort LISTsort BLOCK LISTsort SUBNAME LIST sort的用法有如上3种形式.它对LIST进行排序,并返回排序后的列表.假如忽略了SUBNA ...
- 利用 Excel 公式进行数据整理
一个考勤机里导出来的数据明细: A3公式:=IF(MOD(ROW(Sheet1!U5),2)=1,Sheet1!U5,INDIRECT("Sheet1!U"&ROW(She ...
- Fragment的陷阱(转)
以前做过的一个项目,Fragment嵌套高德地图,当再次进入Fragment的时候,会出现奇怪的现象.嵌套的地图会出现滑动不动的情况,起先还以为是高德的bug呢,经过一番研究,终确定这是一个坑. 先对 ...
- Oracle linux6.1配置yum本地源
一.准备工作1. Linux安装盘插入光驱2. 挂载光驱 [root@localhost ~]# mount /dev/cdrom /mnt/ mount: block device /dev/sr0 ...
- AndroidManifest.xml
一.关于AndroidManifest.xml AndroidManifest.xml 是每个android程序中必须的文件.它位于整个项目的根目录,描述了package中暴露的组件(activiti ...
- ThinkPHP的路由形式
首先解释一下,这里路由的意思是:系统从URL参数中分析出当前请求的分组.控制器.操作 .另外我的网址根目录是放在article目录下的,Thinkphp主要有下面几种路由形式 1.pathinfo路径 ...
- 稍览了一下CommonJS
CommonJS是服务器端模块的规范,现在炒得很火的Node.js采用了这个规范. 根据CommonJS规范,一个单独的文件就是一个模块.加载模块使用require方法,该方法读取一个文件并执行,最后 ...
- 一个CString的实现 拷贝构造函数的应用
class CString { public: CString (char* s); CString(); ~CString(); private: char *str; int len; stati ...
- Java分布式Socket监控项目思考
内容说明 一项课程作业Java编写Socket长连接监控分布式终端,并将终端状态写入数据库供前端查询 基础:c++/Posix/APUE/Mysql&sqlite 核心内容:Socket/线程 ...