C:Program FilesMySQLMySQL Server 5.0bin>mysql -uroot test
D:sphinxbin>indexer.exe test1
Sphinx 0.9.8-release (r1533)
Copyright (c) 2001-2008, Andrew Aksyonoff
using config file ‘./sphinx.conf’…
indexing index ‘test1′…
collected 4 docs, 0.0 MB
sorted 0.0 Mhits, 100.0% done
total 4 docs, 193 bytes
total 0.101 sec, 1916.30 bytes/sec, 39.72 docs/sec
D:sphinxbin>
6.搜索’test’试试
D:sphinxbin>search.exe test
Sphinx 0.9.8-release (r1533)
Copyright (c) 2001-2008, Andrew Aksyonoff
using config file ‘./sphinx.conf’…
index ‘test1′: query ‘test ‘: returned 3 matches of 3 total in 0.000 sec
displaying matches:
1. document=1, weight=2, group_id=1, date_added=Wed Nov 26 14:58:59 2008
;;;;;id=1
;;;;;group_id=1
;;;;;group_id2=5
;;;;;date_added=2008-11-26 14:58:59
;;;;;title=test one
;;;;;content=this is my test document number one. also checking search within
;phrases.
2. document=2, weight=2, group_id=1, date_added=Wed Nov 26 14:58:59 2008
;;;;;id=2
;;;;;group_id=1
;;;;;group_id2=6
;;;;;date_added=2008-11-26 14:58:59
;;;;;title=test two
;;;;;content=this is my test document number two
3. document=4, weight=1, group_id=2, date_added=Wed Nov 26 14:58:59 2008
;;;;;id=4
;;;;;group_id=2
;;;;;group_id2=8
;;;;;date_added=2008-11-26 14:58:59
;;;;;title=doc number four
;;;;;content=this is to test groups
words:
1. ‘test’: 3 documents, 5 hits
D:sphinxbin>
都所出来了吧 。
【Sphinx在windows下安装使用[支持中文全文检索]】6.测试中文搜索
修改test数据库中documents数据表,
UPDATE `test`.`documents` SET `title` = ‘测试中文’, `content` = ‘this is my test document number two,应该搜的到吧’ WHERE `documents`.`id` = 2;
重建索引:
D:sphinxbin>indexer.exe –all
搜索’中文’试试:
D:sphinxbin>search.exe 中文
Sphinx 0.9.8-release (r1533)
Copyright (c) 2001-2008, Andrew Aksyonoff
using config file ‘./sphinx.conf’…
index ‘test1′: query ‘中文 ‘: returned 0 matches of 0 total in 0.000 sec
words:
D:sphinxbin>
貌似没有搜到,这是因为windows命令行中的编码是gbk,当然搜不出来 。我们可以用程序试试,在D:sphinxapi下新建一个foo.php的文件,注意utf-8编码
require ’sphinxapi.php’;
$s = new SphinxClient();
$s->SetServer(’localhost’,3312);
$result = $s->Query(’中文’);
var_dump($result);
?>
启动Sphinx searchd服务
D:sphinxbin>searchd.exe
Sphinx 0.9.8-release (r1533)
Copyright (c) 2001-2008, Andrew Aksyonoff
WARNING: forcing –console mode on Windows
using config file ‘./sphinx.conf’…
creating server socket on 0.0.0.0:3312
accepting connections
执行PHP查询:
php d:/sphinx/api/foo.php
结果是不是出来?剩下的工作就是去看手册,慢慢摸索高阶的配置 。
推荐阅读
- 教你设置Windows 7下VMware虚拟机上网
- 华为手表排水功能在哪里
- 诺基亚7500P小常识
- 重装Windows系统不可忽视的几个小技巧经验技巧
- 在荣耀畅玩8C中如何打开微信分身?微信分身打开方法说明
- Windows系统中打造个性化超级回收站
- oppo耳机模式在哪里设置怎么取消
- 在BarTender如何移动条码对象?
- Windows 功能互补技巧大放送经验技巧
- 电脑操作系统硬件冲突故障解决六个经验技巧
