query() public méthode

Connect to searchd server, run given search query through given indexes, and return the results
public query ( string $query, string $index = '*', string $comment = '' ) : array | false
$query string query string
$index string index name
$comment string optional comment
Résultat array | false Results array, or false upon error.
 /**
  * Search for a query string
  * @param  string  $query   Search query
  * @param  array   $indexes Index list to perform the search
  * @param  boolean $escape  Should the query to be escaped?
  *
  * @return array           Search results
  *
  * @throws EmptyIndexException If $indexes is empty
  * @throws \RuntimeException If seaarch failed
  */
 public function search($query, array $indexes, $escape = true)
 {
     if (empty($indexes)) {
         throw new EmptyIndexException('Try to search with empty indexes');
     }
     if ($escape) {
         $query = $this->sphinx->escapeString($query);
     }
     $qIndex = implode(' ', $indexes);
     $results = $this->sphinx->query($query, $qIndex);
     if (!is_array($results)) {
         throw new \RuntimeException(sprintf('Searching for "%s" failed. Result is not an array. Error "%s"', $query, $this->sphinx->getLastError()));
     }
     if (!isset($results['status'])) {
         throw new \RuntimeException(sprintf('Searching for "%s" failed. Result with no status. Error "%s"', $query, $this->sphinx->getLastError()));
     }
     if ($results['status'] !== SphinxClient::SEARCHD_OK && $results['status'] !== SphinxClient::SEARCHD_WARNING) {
         throw new \RuntimeException(sprintf('Searching for "%s" failed. Result has bad status. Error "%s"', $query, $this->sphinx->getLastError()));
     }
     return $results;
 }
 public function testGeoAnchor()
 {
     $sphinx = new SphinxClient();
     $sphinx->setGeoAnchor('lat', 'long', 0.4, 0.4)->setMatchMode(SphinxClient::SPH_MATCH_EXTENDED)->setSortMode(SphinxClient::SPH_SORT_EXTENDED, '@geodist desc')->setFilterFloatRange('@geodist', 0, 1934127);
     $results = $sphinx->query('a');
     $this->assertEquals(array_keys($results['matches']), array('1', '3', '4'));
 }
 /**
  * {@inheritdoc}
  */
 public function query($query, $index = '*', $comment = '')
 {
     return $this->proxy->query($query, $index, $comment);
 }