mysql -uroot test 5.建立索引 D:sphinxbin>indexer.exe test1 Sphinx 0.9.8-release (r1533) Copyright (c) 2001-2008, Andrew Aksyonoff using config file ‘./sph。Sphinx在windows下安裝使用[支持中文全文檢索]( 二 )。" />

日本免费全黄少妇一区二区三区-高清无码一区二区三区四区-欧美中文字幕日韩在线观看-国产福利诱惑在线网站-国产中文字幕一区在线-亚洲欧美精品日韩一区-久久国产精品国产精品国产-国产精久久久久久一区二区三区-欧美亚洲国产精品久久久久

Sphinx在windows下安裝使用[支持中文全文檢索]( 二 )


C:Program FilesMySQLMySQL Server 5.0bin>mysql -uroot test 5.建立索引
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數(shù)據(jù)庫中documents數(shù)據(jù)表,
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
執(zhí)行PHP查詢:
php d:/sphinx/api/foo.php
結(jié)果是不是出來?剩下的工作就是去看手冊,慢慢摸索高階的配置 。

推薦閱讀