coreseek 全文搜索的问题

WBOY
Release: 2016-06-23 14:09:03
Original
1012 people have browsed it

我是在windows下面装的coreseek
在msdos下面测试都能够搜索,而且搜索出了好多结果,
但是一回到php下面,同样的关键词搜索,却搜不出来,求高手指点

but: 英文在php页面能搜出来

这是我的PHP代码

require ( "sphinxapi.php" );$cl = new SphinxClient ();$cl->SetServer ( '127.0.0.1', 9312);//以下设置用于返回数组形式的结果$cl->SetArrayResult ( true );/*//ID的过滤$cl->SetIDRange(3,4);//sql_attr_uint等类型的属性字段,需要使用setFilter过滤,类似SQL的WHERE group_id=2$cl->setFilter('group_id',array(2));//sql_attr_uint等类型的属性字段,也可以设置过滤范围,类似SQL的WHERE group_id2>=6 AND group_id2<=8$cl->SetFilterRange('group_id2',6,8);*///取从头开始的前20条数据,0,20类似SQl语句的LIMIT 0,20$cl->SetLimits(0,20);//在做索引时,没有进行 sql_attr_类型 设置的字段,可以作为“搜索字符串”,进行全文搜索$res = $cl->Query ( 'ai', "*" );    //"*"表示在所有索引里面同时搜索,"索引名称(例如test或者test,test2)"则表示搜索指定的//如果需要搜索指定全文字段的内容,可以使用扩展匹配模式:#$cl->SetMatchMode(SPH_MATCH_EXTENDED);//$res=$cl->Query( "@title ('测试')" , "*");//$res=cl->Query( '@title (测试) @content ('网络')' , "*");echo '<pre class="brush:php;toolbar:false">';print_r($res['matches']);print_r($res);print_r($cl->GetLastError());print_r($cl->GetLastWarning());echo '
Copy after login
';?>


回复讨论(解决方案)

字符集问题
msdos 下是操作系统默认字符集 GBK
你的程序使用了 utf-8

字符集问题
msdos 下是操作系统默认字符集 GBK
你的程序使用了 utf-8
我在msdos使用icnov转码 相当于也是使用utf8

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!