laravel 5 狮身人面像搜索

laravel 5 sphinx search

我正在尝试使用此库在 laravel 5.2 中使用 sphinx :https://github.com/sngrl/sphinxsearch

我已经按照所有步骤操作,更改了端口,但我遇到了这个问题: SphinxClient.php 第 418 行中的错误异常:Undefined offset: 1

HandleExceptions->handleError('8', 'Undefined offset: 1', '/var/www/html/test/vendor/gigablah/sphinxphp/src/Sphinx/SphinxClient.php', '418', array('errno' => '0', 'errstr' => '', 'host' => 'localhost', 'port' => '5432', 'fp' => resource)) 

在 SphinxClient.php 第 418 行的 SphinxClient->connect() 在 SphinxClient.php 第 1362 行

我不确定与sphinx 的连接设置是否完成。非常感谢您的帮助。

提前致谢 苛刻的僧伽尼

在找到问题的所有位置后,我幸运地结合了 2-3 个答案。

我必须对供应商文件进行一些更改:- SphinxClient.php

必须注释掉以下代码:-

/*
    list(, $v) = unpack('N*', fread($fp, 4));
    $v = (int) $v;
    if ($v < 1) {
        fclose($fp);
        $this->error = sprintf('expected searchd protocol version 1+, got version \'%d\'', $v);

        return false;
    }
*/

并在上述注释代码之前添加以下代码:-

$r=unpack ( "N*", fread ( $fp, 4 ) );
if(!isset($r[1])){
    fclose ( $fp );
    $this->_error = "connected to host, but returned data is not correct";
    return false;
}

现在我无法得到那个错误并使用 sphinx 搜索得到结果