Guest User

Untitled

a guest
Jun 22nd, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. <?php
  2. public function querySphinx($string, $options)
  3. {
  4. $this->sphinx->SetSortMode(SPH_SORT_RELEVANCE);
  5. $this->sphinx->SetLimits(0, 500);
  6. $this->sphinx->SetMatchMode(SPH_MATCH_ALL);
  7.  
  8. if ($options['system'] !== 'all')
  9. $this->sphinx->SetFilter('system', array($this->crc32($options['system'])));
  10.  
  11. if ($options['region'] !== 'all')
  12. $this->sphinx->SetFilter('region', array(
  13. $this->crc32('(' . $options['region'] . ')'),
  14. $this->crc32('[' . $options['region'] . ']')
  15. ));
  16.  
  17. $result = $this->sphinx->Query($string, 'romulation_files');
  18.  
  19. if (!$result)
  20. die('Failed with error:' . $this->sphinx->GetLastError());
  21.  
  22. if ( !isset($result['matches']) )
  23. return false;
  24.  
  25. return join( ',', array_keys($result['matches']) );
  26. }
  27. ?>
Add Comment
Please, Sign In to add comment