Advertisement
Guest User

Sphinx Fail

a guest
Nov 5th, 2012
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.44 KB | None | 0 0
  1. <?php
  2.     require("sphinxapi.php");
  3.    
  4.     if(isset($_POST)){
  5.         $searchTerm = $_POST['searchterm'];
  6.         $sphinx = new SphinxClient();
  7.         $sphinx->SetServer('localhost', 9312);
  8.         $sphinx->SetMatchMode(SPH_MATCH_ALL);
  9.         $sphinx->SetArrayResult(true);
  10.        
  11.         $results = $sphinx->Query($searchTerm, 'movieindex');
  12.        
  13.         echo $sphinx->GetLastError();
  14.         echo $sphinx->GetLastWarning();
  15.        
  16.         foreach($results['matches'] as $id)
  17.         {
  18.             echo $id;
  19.         }
  20.     }
  21. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement