PHP SphinxClient无法获得长时间执行查询结果

时间:2013-03-27 23:08:44

标签: php sphinx

我正在尝试获取一些长时间执行查询的结果。每个查询都具有相同的结构:

    @CODE (ZZZZZZ|YYYYY...) @FIELD2 YES

每个查询在70-100秒内完成(我正在使用searchd --console进行检查)。 但PHP代码停止等待第60秒的响应并丢弃错误

  received zero-sized searchd response 

看起来连接掉线了吗? 我正在使用常规的SphinxClient。用于调用sphinx搜索的PHP代码如下:

$this->client->SetServer($this->host, $this->port);
$this->client->SetArrayResult(true);
$this->client->SetWeights(array(100, 1));
$this->client->SetMatchMode($this->mode);
$this->client->SetMaxQueryTime(5000000);
$this->client->SetLimits($this->offset, $this->limit, ($this->limit > 1000) ? $this->limit : 1000);
$this->result = $this->client->Query($this->query, $this->index);

使用

配置的PHP
max_execution_time = 120
max_input_time = 120

这是否可以设置一些系统设置 - 所以脚本可以等待响应更长的时间?我正在使用Debian GNU / Linux 5.0.3 Lenny

1 个答案:

答案 0 :(得分:3)

您是否尝试过设置setConnectionTimeout?

http://sphinxsearch.com/docs/current.html#api-func-setconnecttimeout


尽管设置stream_set_timeout可能更好 http://www.php.net/manual/en/function.stream-set-timeout.php 将不得不hotwire sphinxapi.php添加一个调用。

相关问题