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的安装与测试的更多相关文章

  1. Windows下的Memcache安装与测试教程

    Windows下的Memcache安装 1.下载memcache for windows. 下载地址:http://splinedancer.com/memcached-win32/,推荐下载bina ...

  2. 最实用windows 下python+numpy安装(转载)

    最实用windows 下python+numpy安装 如题,今天兜兜转转找了很多网站帖子,一个个环节击破,最后装好费了不少时间. 希望这个帖子能帮助有需要的人,教你一篇帖子搞定python+numpy ...

  3. Windows下的Memcache安装 linux下的Memcache安装

    linux下的Memcache安装: 1. 下载 memcache的linux版本,注意 memcached 用 libevent 来作事件驱动,所以要先安装有 libevent. 官方网址:http ...

  4. Windows下的Memcache安装

    Windows下的Memcache安装: 1. 下载memcache的windows稳定版,解压放某个盘下面,比如在c:\memcached2. 在终端(也即cmd命令界面)下输入 'c:\memca ...

  5. Windows下 VM12虚拟机安装OS X 10.11 和VM TOOLS

    Windows下虚拟机安装Mac OS X —– VMware Workstation12安装Mac OS X 10.11 本文即将介绍WIN虚拟MAC的教程.完整详细教程(包含安装中的一些问题) [ ...

  6. Windows下Memcache的安装与在php中使用

    memcache dll插件和测试例子下载地址: http://pecl.php.net/package/memcache Windows下Memcache的安装方法 Memcached官方:http ...

  7. Mysql在windows下的免安装配置步骤和重新安装的步骤

    windows下mysql免安装配置 1. 下载mysql免安装压缩包 下载mysql-5.6.22-winx64.zip 解压到本地D:\mysql-5.6.22-winx64 2. 修改配置文件 ...

  8. DEDECMS最新5.7版在Windows下的Memcache安装

    一,织梦后台后台设置进入系统后台,在[系统基本参数]下面的"性能选项"卡当中,关于memcache进行如下配置: cfg_memcache_enable : 是否启用memcach ...

  9. Windows下的Memcache安装:

    Windows下的Memcache安装:1. 下载memcache的windows稳定版,解压放某个盘下面,比如在c:\memcached2. 在终端(也即cmd命令界面)下输入 'c:\memcac ...

随机推荐

  1. PDO多种方式取得查询结果

    PDO多种方式取得查询结果 01 December 2009 1:26 Tuesday by Sjolzy PDO最大的特点之一是它的灵活性,本节将介绍如何取得查询结果,包括: 数组(数值或关联数组) ...

  2. springfox.documentation.spi.DocumentationType配置示例

    Java Code Examples for springfox.documentation.spi.DocumentationType The following are top voted exa ...

  3. filter and listener

    Java Servlet 是运行在 Web 服务器或应用服务器上的程序,它是作为来自 Web 浏览器或其他 HTTP 客户端的请求和 HTTP 服务器上的数据库或应用程序之间的中间层. 使用 Serv ...

  4. javascript性能优化总结一(转载人家)

    一直在学习javascript,也有看过<犀利开发Jquery内核详解与实践>,对这本书的评价只有两个字犀利,可能是对javascript理解的还不够透彻异或是自己太笨,更多的是自己不擅于 ...

  5. MapReduce、Hbase接口API实践

    读取hdfs中文件并做处理,取出卡号,通过卡号连接hbase查询出对应客户号,写入redis,因为不用输出,所以不调用context.write方法,整个操作在一个map中便可完成 protected ...

  6. asp.net 运行时,"未能映射路径"

    asp.net 站点出现:未能映射路径,解决方案之一:发现原来是iis 应用程序池中设置了.net framework 版本为4.0了,而且VS中站点的版本为2.0引起的. 解决方案是把VS 中的站点 ...

  7. 46. Partition List

    Partition List Given a linked list and a value x, partition it such that all nodes less than x come ...

  8. SAMEORIGIN

    http://www.css88.com/archives/5141 Response.AppendHeader("X-Frame-Options", "SAMEORIG ...

  9. Apache 配置HTTPS协议搭载SSL配置

    在设置Apache + SSL之前, 需要做:     安装Apache, 请参见: Windows环境下Apache的安装与虚拟目录的配置, 下载安装Apache时请下载带有ssl版本的Apache ...

  10. lintcode-【简单题】链表求和

    题目: 你有两个用链表代表的整数,其中每个节点包含一个数字.数字存储按照在原来整数中相反的顺序,使得第一个数字位于链表的开头.写出一个函数将两个整数相加,用链表形式返回和. 样例: 给出两个链表 3- ...