/**
  * Highlight $text for the $query using $index
  * @param string $text Text content
  * @param string $index Sphinx index name
  * @param string $query Query to search
  * @param array[optional] $options Options to pass to SphinxAPI
  *
  * @return string
  */
 public function sphinx_highlight($text, $index, $query, $options = array())
 {
     $result = $this->searchd->getClient()->BuildExcerpts(array((string) $text), $index, $query, $options);
     if (!empty($result[0])) {
         return $result[0];
     } else {
         return '';
     }
 }
 /**
  * Returns the number of results.
  *
  * @return integer The number of results.
  */
 function getNbResults()
 {
     $this->sphinx->SetLimits(1, 1, $this->options['max_results']);
     $results = $this->sphinx->searchEx($this->query, $this->options['entity']);
     return $results['total_found'];
 }