coreseek 全文搜索的问题
Jun 23, 2016 pm 02:09 PM 我是在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 '
回复讨论(解决方案)
字符集问题
msdos 下是操作系统默认字符集 GBK
你的程序使用了 utf-8
字符集问题
msdos 下是操作系统默认字符集 GBK
你的程序使用了 utf-8
我在msdos使用icnov转码 相当于也是使用utf8

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

11 Best PHP URL Shortener Scripts (Free and Premium)

Working with Flash Session Data in Laravel

Build a React App With a Laravel Back End: Part 2, React

Simplified HTTP Response Mocking in Laravel Tests

cURL in PHP: How to Use the PHP cURL Extension in REST APIs

12 Best PHP Chat Scripts on CodeCanyon

Announcement of 2025 PHP Situation Survey
