original_string: public function search($query, array $indexes, array $options = array(), $escapeQuery = true)
      {
          if ($escapeQuery) {
              $query = $this->sphinx->escapeString($query);
          }
  
          /**
           * Build the list of indexes to be queried.
           */
          $indexNames = '';
          foreach ($indexes as &$label) {
              if (isset($this->indexes[$label])) {
                  $indexNames .= $this->indexes[$label] . ' ';
              }
          }
  
          $indexNames = trim($indexNames);
  
          /**
           * If no valid indexes were specified, return an empty result set.
           */
          if (empty($indexNames)) {
              return array();
          }
  
          /**
           * Set the offset and limit for the returned results.
           */
          if (isset($options['result_offset']) && isset($options['result_limit'])) {
              $this->sphinx->setLimits($options['result_offset'], $options['result_limit']);
          }
  
          /**
           * Weight the individual fields.
           */
          if (isset($options['field_weights'])) {
              $this->sphinx->setFieldWeights($options['field_weights']);
          }
  
          /**
           * Perform the query.
           */
          $results = $this->sphinx->query($query, $indexNames);
          if ($results === false || $results['status'] !== SEARCHD_OK) {
              if(is_array($results) && $results['status'] === SEARCHD_WARNING) {
                  $errorText = $this->sphinx->getLastWarning();
              } else {
                  $errorText = $this->sphinx->getLastError();
              }
  
              throw new \RuntimeException(sprintf(
                  'Searching index "%s" for "%s" failed with message "%s".',
                  $label,
                  $query,
                  $errorText
              ));
          }
  
  
          return $results;
      }
code: public function search($query, array $indexes, array $options = array(), $escapeQuery = true)
      {
          if ($escapeQuery) {
              $query = $this->sphinx->escapeString($query);
          }
  
          /**
           * Build the list of indexes to be queried.
           */
          $indexNames = '';
          foreach ($indexes as &$label) {
              if (isset($this->indexes[$label])) {
                  $indexNames .= $this->indexes[$label] . ' ';
              }
          }
  
          $indexNames = trim($indexNames);
  
          /**
           * If no valid indexes were specified, return an empty result set.
           */
          if (empty($indexNames)) {
              return array();
          }
  
          /**
           * Set the offset and limit for the returned results.
           */
          if (isset($options['result_offset']) && isset($options['result_limit'])) {
              $this->sphinx->setLimits($options['result_offset'], $options['result_limit']);
          }
  
          /**
           * Weight the individual fields.
           */
          if (isset($options['field_weights'])) {
              $this->sphinx->setFieldWeights($options['field_weights']);
          }
  
          /**
           * Perform the query.
           */
          $results = $this->sphinx->query($query, $indexNames);
          if ($results === false || $results['status'] !== SEARCHD_OK) {
              if(is_array($results) && $results['status'] === SEARCHD_WARNING) {
                  $errorText = $this->sphinx->getLastWarning();
              } else {
                  $errorText = $this->sphinx->getLastError();
              }
  
              throw new \RuntimeException(sprintf(
                  'Searching index "%s" for "%s" failed with message "%s".',
                  $label,
                  $query,
                  $errorText
              ));
          }
  
  
          return $results;
      }
code_tokens: public function search ( $ query , array $ indexes , array $ options = array ( ) , $ escapeQuery = true ) { if ( $ escapeQuery ) { $ query = $ this -> sphinx -> escapeString ( $ query ) ; } /**
           * Build the list of indexes to be queried.
           */ $ indexNames = '' ; foreach ( $ indexes as & $ label ) { if ( isset ( $ this -> indexes [ $ label ] ) ) { $ indexNames .= $ this -> indexes [ $ label ] . ' ' ; } } $ indexNames = trim ( $ indexNames ) ; /**
           * If no valid indexes were specified, return an empty result set.
           */ if ( empty ( $ indexNames ) ) { return array ( ) ; } /**
           * Set the offset and limit for the returned results.
           */ if ( isset ( $ options [ 'result_offset' ] ) && isset ( $ options [ 'result_limit' ] ) ) { $ this -> sphinx -> setLimits ( $ options [ 'result_offset' ] , $ options [ 'result_limit' ] ) ; } /**
           * Weight the individual fields.
           */ if ( isset ( $ options [ 'field_weights' ] ) ) { $ this -> sphinx -> setFieldWeights ( $ options [ 'field_weights' ] ) ; } /**
           * Perform the query.
           */ $ results = $ this -> sphinx -> query ( $ query , $ indexNames ) ; if ( $ results === false || $ results [ 'status' ] !== SEARCHD_OK ) { if ( is_array ( $ results ) && $ results [ 'status' ] === SEARCHD_WARNING ) { $ errorText = $ this -> sphinx -> getLastWarning ( ) ; } else { $ errorText = $ this -> sphinx -> getLastError ( ) ; } throw new \ RuntimeException ( sprintf ( 'Searching index "%s" for "%s" failed with message "%s".' , $ label , $ query , $ errorText ) ) ; } return $ results ; }
docstring: Search for the specified query string.
  
  @param string $query       The query string that we are searching for.
  @param array  $indexes     The indexes to perform the search on.
  @param array  $options     The options for the query.
  @param bool   $escapeQuery Should the query string be escaped?
  
  @return array|bool The results of the search.
  @throws \RuntimeException
docstring_tokens: Search for the specified query string .