使用客户端的对象进行搜索出现以下错误
Query failed: received zero-sized searchd response. 服务端的配置如下
#源定义
source mysql
{
type = mysql sql_host = 192.168.57.112
sql_user = root
sql_pass =
sql_db = test
sql_port = 3306
sql_query_pre = SET NAMES utf8 sql_query = SELECT id, news_id, news_title, news_content ,news_announcedateline FROM news_all
sql_attr_timestamp = news_announcedateline
}#index定义
index mysql
{
source = mysql
path = E:/coreseek/var/data/mysql
charset_dictpath = E:/coreseek/etc/
charset_type = zh_cn.utf-8
}#全局index定义
indexer
{
mem_limit = 256M
}#searchd服务定义
searchd
{
listen = 9310
max_matches = 1000
pid_file = E:/coreseek/var/log/searchd_mysql.pid
log = E:/coreseek/var/log/searchd_mysql.log
query_log = E:/coreseek/var/log/query_mysql.log
}
test.php内容如下:include 'sphinxapi.php';
$sc = new SphinxClient();
$sc->setServer('127.0.0.1', 9310);
$sc->SetConnectTimeout ( 10 );
$res = $sc->query('hello', 'mysql');
if ( $res===false )
{
print "Query failed: " . $sc->GetLastError() . ".\n";}else
{
print_r($res);
}运行结果:
Query failed: received zero-sized searchd response. sphinxcoreseekreceived zero-sized searchd response
Query failed: received zero-sized searchd response. 服务端的配置如下
#源定义
source mysql
{
type = mysql sql_host = 192.168.57.112
sql_user = root
sql_pass =
sql_db = test
sql_port = 3306
sql_query_pre = SET NAMES utf8 sql_query = SELECT id, news_id, news_title, news_content ,news_announcedateline FROM news_all
sql_attr_timestamp = news_announcedateline
}#index定义
index mysql
{
source = mysql
path = E:/coreseek/var/data/mysql
charset_dictpath = E:/coreseek/etc/
charset_type = zh_cn.utf-8
}#全局index定义
indexer
{
mem_limit = 256M
}#searchd服务定义
searchd
{
listen = 9310
max_matches = 1000
pid_file = E:/coreseek/var/log/searchd_mysql.pid
log = E:/coreseek/var/log/searchd_mysql.log
query_log = E:/coreseek/var/log/query_mysql.log
}
test.php内容如下:include 'sphinxapi.php';
$sc = new SphinxClient();
$sc->setServer('127.0.0.1', 9310);
$sc->SetConnectTimeout ( 10 );
$res = $sc->query('hello', 'mysql');
if ( $res===false )
{
print "Query failed: " . $sc->GetLastError() . ".\n";}else
{
print_r($res);
}运行结果:
Query failed: received zero-sized searchd response. sphinxcoreseekreceived zero-sized searchd response
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货