Table of Contents
回复讨论(解决方案)
Home Backend Development PHP Tutorial coreseek 全文搜索的问题

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 '
Copy after login
';?>


回复讨论(解决方案)

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

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

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

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

11 Best PHP URL Shortener Scripts (Free and Premium) 11 Best PHP URL Shortener Scripts (Free and Premium) Mar 03, 2025 am 10:49 AM

11 Best PHP URL Shortener Scripts (Free and Premium)

Working with Flash Session Data in Laravel Working with Flash Session Data in Laravel Mar 12, 2025 pm 05:08 PM

Working with Flash Session Data in Laravel

Build a React App With a Laravel Back End: Part 2, React Build a React App With a Laravel Back End: Part 2, React Mar 04, 2025 am 09:33 AM

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

Simplified HTTP Response Mocking in Laravel Tests Simplified HTTP Response Mocking in Laravel Tests Mar 12, 2025 pm 05:09 PM

Simplified HTTP Response Mocking in Laravel Tests

cURL in PHP: How to Use the PHP cURL Extension in REST APIs cURL in PHP: How to Use the PHP cURL Extension in REST APIs Mar 14, 2025 am 11:42 AM

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

12 Best PHP Chat Scripts on CodeCanyon 12 Best PHP Chat Scripts on CodeCanyon Mar 13, 2025 pm 12:08 PM

12 Best PHP Chat Scripts on CodeCanyon

Announcement of 2025 PHP Situation Survey Announcement of 2025 PHP Situation Survey Mar 03, 2025 pm 04:20 PM

Announcement of 2025 PHP Situation Survey

Notifications in Laravel Notifications in Laravel Mar 04, 2025 am 09:22 AM

Notifications in Laravel

See all articles