简体   繁体   中英

Sphinx failed to read searchd response

I am getting error when I am executing following code. I am using SPhinx with 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;

Getting this error

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).

I am running Sphinx with Wamp. Any idea about the cause of the problem ?

Port 9306, is usually the port that sphinx listens with sphinxQL on.

Really does suggest you should use SphinxQL, not the SphinxAPI. Starting a new project with SphinxAPI is NOT recommended.

There is not special client to use SphinxQL, you just use any ol' MySQL-client.

The mysql_* functions will work, or better is mysqli, or even pdo etc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM