Table of Contents
回复讨论(解决方案)

sphinx匹配问题

Jun 23, 2016 pm 01:43 PM

配置好像是没什么问题的,在命令行下可以取得匹配结果,但是引入到PHP中却没有结果,用的是CORESEEK。
今天刚学sphinx,不知是哪里出了问题,上网查也没碰到类似问题:
这是配置文件:

#MySQL数据源配置,详情请查看:http://www.coreseek.cn/products-install/mysql/#请先将var/test/documents.sql导入数据库,并配置好以下的MySQL用户密码数据库#源定义source cetsix{    type                    = mysql    sql_host                = localhost    sql_user                = root    sql_pass                = cai123    sql_db                  = words    sql_port                = 3306    sql_query_pre           = SET NAMES UTF8	sql_query               = SELECT id, meaning ,lx FROM cetsix}#index定义index cetsix{    source            = cetsix             #对应的source名称    path              = E:\CodeEdit\php\ciba\niujin-alpha\sphinx\var\data\cetsix    docinfo           = extern    mlock             = 0    morphology        = none    min_word_len      = 1    html_strip        = 0    charset_dictpath = E:\CodeEdit\php\ciba\niujin-alpha\sphinx\etc    charset_type        = utf-8}indexer{    mem_limit            = 128M}#searchd服务定义searchd{    listen                  = 3312    read_timeout        	= 5    max_children        	= 30    max_matches             = 100    seamless_rotate         = 1    preopen_indexes         = 0    unlink_old              = 1		#最大允许的过滤器数    max_filters        = 256    #每个过滤器最大允许的值的个数    max_filter_values  = 4096			#日志文件保存路径    pid_file = E:\CodeEdit\php\ciba\niujin-alpha\sphinx\var\log\searchd_mysql.pid      log = E:\CodeEdit\php\ciba\niujin-alpha\sphinx\var\log\searchd_mysql.log            query_log = E:\CodeEdit\php\ciba\niujin-alpha\sphinx\var\log\query_mysql.log }
Copy after login


这是PHP测试代码:
<?phpheader("content-type: text/html; charset=utf-8");require_once "sphinxapi.php";$sphinx = new SphinxClient();$sphinx->setServer("127.0.0.1", 3312);$sphinx->setMatchMode('SPH_MATCH_ANY');$res = $sphinx->query('man', "cetsix");var_dump($res);?>
Copy after login

数据库编码如下:
mysql> SHOW CREATE TABLE cetsix    -> ;+--------+---------------------------------------------------| Table  | Create Table+--------+---------------------------------------------------| cetsix | CREATE TABLE `cetsix` (  `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,  `word` varchar(255) NOT NULL,  `meaning` varchar(255) NOT NULL,  `lx` text NOT NULL,  PRIMARY KEY (`id`)) ENGINE=MyISAM AUTO_INCREMENT=13325 DEFAULT CHARSET=utf8 |+--------+---------------------------------------------------
Copy after login

在命令行下是可以返回结果的:

C:\windows\system32>E:\CodeEdit\php\ciba\niujin-alpha\sphinx\bin\search.exe  --c
onfig E:\CodeEdit\php\ciba\niujin-alpha\sphinx\sphinx.conf  man
Coreseek Fulltext 3.2 [ Sphinx 0.9.9-release (r2117)]
Copyright (c) 2007-2011,
Beijing Choice Software Technologies Inc (http://www.coreseek.com)

 using config file 'E:\CodeEdit\php\ciba\niujin-alpha\sphinx\sphinx.conf'...
index 'cetsix': query 'man ': returned 199 matches of 199 total in 0.001 sec

displaying matches:
1. document=4, weight=1
2. document=10, weight=1
3. document=24, weight=1
4. document=45, weight=1
5. document=186, weight=1
6. document=193, weight=1
7. document=239, weight=1
8. document=240, weight=1
9. document=394, weight=1
10. document=454, weight=1
11. document=466, weight=1
12. document=483, weight=1
13. document=514, weight=1
14. document=543, weight=1
15. document=653, weight=1
16. document=750, weight=1
17. document=930, weight=1

服务也启动正常。。 真不知道是哪里出了问题


回复讨论(解决方案)

  看了下手册又解决了,送分拉

我去 大早上的看见有人送分

接分啦

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 AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

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)

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

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

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

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

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

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

PHP Logging: Best Practices for PHP Log Analysis PHP Logging: Best Practices for PHP Log Analysis Mar 10, 2025 pm 02:32 PM

PHP logging is essential for monitoring and debugging web applications, as well as capturing critical events, errors, and runtime behavior. It provides valuable insights into system performance, helps identify issues, and supports faster troubleshoot

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

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

Explain the concept of late static binding in PHP. Explain the concept of late static binding in PHP. Mar 21, 2025 pm 01:33 PM

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

Customizing/Extending Frameworks: How to add custom functionality. Customizing/Extending Frameworks: How to add custom functionality. Mar 28, 2025 pm 05:12 PM

The article discusses adding custom functionality to frameworks, focusing on understanding architecture, identifying extension points, and best practices for integration and debugging.

See all articles