无法读取 searchd 响应
我在 Sphinx 中遇到此错误。
{"status":"failed","status_message":"failed to read searchd response (status=2613, ver=11829, len=774975488, read=66)"}
PHP文件>>我正在学习这个 教程
<?php
require_once('sphinxapi.php');
$sphinxClient = new SphinxClient();
$sphinxClient->SetServer( 'localhost', 3306 );
$sphinxClient->SetConnectTimeout( 1 );
$sphinxClient->SetFieldWeights(array('title' => 70, 'body_text' => 30));
$sphinxClient->SetMatchMode( SPH_MATCH_EXTENDED2 );
$sphinxClient->SetLimits( 0, 20, 1000 );
$sphinxClient->SetRankingMode( SPH_RANK_PROXIMITY_BM25 );
$sphinxClient->SetArrayResult( true );
$searchQuery = "SELECT title FROM `documents` WHERE 1";
$searchResults = $sphinxClient->Query( $searchQuery, '*' );
$jhash = array();
if ( $searchResults === false )
{
$jhash['status'] = 'failed';
$jhash['status_message'] = $sphinxClient->GetLastError();
}
else
{
if ( $sphinxClient->GetLastWarning() )
{
$jhash['status'] = 'warning';
$jhash['status_message'] = $sphinxClient->GetLastWarning();
}
else
{
$jhash['status'] = 'good';
}
$jhash['result_total'] = $searchResults['total'];
$jhash['result_found'] = $searchResults['total_found'];
$jhash_matches = array();
if ( is_array($searchResults["matches"]) )
{
$row_ids = array();
foreach ( $searchResults["matches"] as $docinfo )
{
array_push($row_ids, mysql_real_escape_string($docinfo['id']));
}
}
$jhash['matches'] = $jhash_matches;
}
echo json_encode($jhash);
?>
关于原因的任何想法问题出在哪里?
I Got this error in Sphinx.
{"status":"failed","status_message":"failed to read searchd response (status=2613, ver=11829, len=774975488, read=66)"}
PHP file >> i am fallowing this tutorial
<?php
require_once('sphinxapi.php');
$sphinxClient = new SphinxClient();
$sphinxClient->SetServer( 'localhost', 3306 );
$sphinxClient->SetConnectTimeout( 1 );
$sphinxClient->SetFieldWeights(array('title' => 70, 'body_text' => 30));
$sphinxClient->SetMatchMode( SPH_MATCH_EXTENDED2 );
$sphinxClient->SetLimits( 0, 20, 1000 );
$sphinxClient->SetRankingMode( SPH_RANK_PROXIMITY_BM25 );
$sphinxClient->SetArrayResult( true );
$searchQuery = "SELECT title FROM `documents` WHERE 1";
$searchResults = $sphinxClient->Query( $searchQuery, '*' );
$jhash = array();
if ( $searchResults === false )
{
$jhash['status'] = 'failed';
$jhash['status_message'] = $sphinxClient->GetLastError();
}
else
{
if ( $sphinxClient->GetLastWarning() )
{
$jhash['status'] = 'warning';
$jhash['status_message'] = $sphinxClient->GetLastWarning();
}
else
{
$jhash['status'] = 'good';
}
$jhash['result_total'] = $searchResults['total'];
$jhash['result_found'] = $searchResults['total_found'];
$jhash_matches = array();
if ( is_array($searchResults["matches"]) )
{
$row_ids = array();
foreach ( $searchResults["matches"] as $docinfo )
{
array_push($row_ids, mysql_real_escape_string($docinfo['id']));
}
}
$jhash['matches'] = $jhash_matches;
}
echo json_encode($jhash);
?>
Any idea about the cause of the problem ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我也有同样的问题。
在我的配置文件中,我是:
我必须在不同的端口上添加另一个侦听器
,然后在 PHP 中:
不要忘记重新启动 sphinx searchd:
和
I had the same problem.
In my config file I was:
I had to add another listener on a different port
and then in PHP:
Don't forget to restart sphinx searchd:
and
将端口号更改为 sphinx.conf 文件中的任何内容。如果监听 9312 的 sphinx 守护进程在代码中更改如下
$sphinxClient->SetServer( 'localhost', 9312 );
change port number to whatever in your sphinx.conf file. if your sphinx daemon listening to 9312 change in your code as follows
$sphinxClient->SetServer( 'localhost', 9312 );
你真的在运行 Sphinx 守护进程吗?您需要运行如下所示的命令:(
要停止它,只需在其末尾添加 --stop 即可)。
Are you actually running the Sphinx daemon? You'll need to run something like this:
(And to stop it, just add --stop to the end of that).
您不能混合使用 SphinxQL 和 API。您的搜索查询是完整的SphinxQL查询,应该通过php_mysql查询,并且通过API ypu查询应该使用更改,
我也缺少“WHERE 1”的含义;
并且API和SphinxQL应该映射到不同的端口。
You can't intermix SphinxQL and API. You search query is full SphinxQL query that should be queried via php_mysql and to query via API ypu should use change to
I also missing the meaning of "WHERE 1";
And API and SphinxQL should be mapped to different ports.
请查看此处的错误报告。从sphinx服务器读取数据时,PHP API存在问题。
Have a look at the bug report here. The problem exists in the PHP API when reading the data from the sphinx server.