使用的是:sphinx-for-chinese-2.1.0-dev-r3361(http://www.sphinx-search.com/)
字典文件:http://sphinx-for-chinese.googlecode.com/files/xdict_1.1.tar.gz
sphinx.conf 部分配置:
index threadx
{
charset_type = utf-8
chinese_dictionary = /usr/local/sphinx-for-chinese/etc/xdict
html_strip = 0
ngram_len = 1
enable_star = 1
min_infix_len = 1
source = tx
path = /usr/local/sphinx-for-chinese/var/data/threadx
}
表有2个字段:id,title。
id title
1 东海钓鱼岛 北京“横下一条心”挑战日美同盟情
2 【转帖】海钓
3 【新闻】上海钓鱼执法受害者称收到“钓头”恐吓信
4 【新闻】上海钓鱼执法首例案件一审宣判
5 【分享】俺的海钓2,又丰收了
6 【原创】俺的海钓
7 【原创】快乐假期 冬日海钓
8 【原创】渔山海钓
9 【原创】HAOJIU好久没出海钓鱼了
10 【原创】海钓知识普及,看大家有木有兴趣
11 【分享】假日海钓,顺便介绍下海岛景色,攻略在第3页,想来的短信联系
12 【分享】出海钓鱼
搜索“出海钓鱼”,可以得到2条结果; 但是搜索“出海钓”,却没有结果。搜索显示:
[error] =>
[warning] =>
[status] => 0
[fields] => Array
(
[0] => title
)
[attrs] => Array
(
)
[total] => 0
[total_found] => 0
[time] => 0.000
[words] => Array
(
[出] => Array
(
[docs] => 828
[hits] => 837
)
[海钓] => Array
(
[docs] => 7
[hits] => 7
)
)
搜索代码:
<?php
require('includes/sphinxapi.php');
$cl = new SphinxClient ();
$cl->SetServer ( $host, $port );
$cl->SetConnectTimeout ( 1 );
$cl->SetArrayResult ( true );
$cl->SetMatchMode ( SPH_MATCH_EXTENDED2 );
$res = $cl->Query ( "出海钓", "threadx" );
print "<pre>";
print_r($res);
?>
如果mininfixlen设置为0,则索引文件只有几M;而mininfixlen设置为1时,索引文件有几十M,表明中缀索引的确索引了更多的内容。
请问中缀索引为啥没有起作用呢?
好像是需要设置同义词。
看这个:http://www.coreseek.cn/products-install/coreseek_mmseg_complex/