Sphinx未能阅读searchd回复

时间:2014-04-28 08:10:53

标签: php mysql search-engine sphinx

执行以下代码时出错。我正在使用SPhinx和PHP&的MySQL。

  require ( "sphinxapi.php" );
  $cl = new SphinxClient();
  $cl->SetServer( "127.0.0.1", 9306 );
  $cl->SetMatchMode( SPH_MATCH_ANY  );
  $cl->SetFilter( 'model', array( 3 ) );

  $result = $cl->Query( 'is', 'the' );



  if ( $result === false ) {
      echo "Query failed: " . $cl->GetLastError() . ".\n";
  }
  else {
      if ( $cl->GetLastWarning() ) {
          echo "WARNING: " . $cl->GetLastWarning() . "";
      }

      if ( ! empty($result["matches"]) ) {
          foreach ( $result["matches"] as $doc => $docinfo ) {
                echo "$doc\n";
          }

          print_r( $result );
      }
  }

  exit;

获取此错误

Deprecated: DEPRECATED: Do not call this method or, even better, use SphinxQL instead of an API in C:\xampp\htdocs\sphinx\sphinxapi.php on line 764
failed to read searchd response (status=2610, ver=11826, len=775040361, read=61).

我正在使用Wamp运行Sphinx。 有关问题原因的任何想法吗?

1 个答案:

答案 0 :(得分:0)

端口9306,通常是sphinx用 sphinxQL 监听的端口。

确实建议你应该使用SphinxQL,而不是SphinxAPI。不建议使用SphinxAPI启动新项目。

没有特殊的客户端可以使用SphinxQL,你只需使用任何一个'MySQL-client'。

mysql_ *函数可以工作,或者更好的是mysqli,甚至是pdo等。