You are here

public function SearchApiSavedSearch::query in Search API Saved Searches 7

Return value

SearchApiQueryInterface A query for getting all new results for this saved search.

Throws

SearchApiException If the saved search's index is disabled.

File

./search_api_saved_searches.search_entity.inc, line 193
Contains the entity class for saved searches.

Class

SearchApiSavedSearch
Class representing "Saved searches" settings.

Code

public function query() {
  $index = $this
    ->index();
  $query = $index
    ->query($this->query['options']);
  if ($this->query['keys']) {
    $query
      ->keys($this->query['keys']);
  }
  if ($this->query['fields']) {
    $fields = (array) $this->query['fields'];
    $fields = array_intersect($fields, $index
      ->getFulltextFields());
    if ($fields) {
      $query
        ->fields($fields);
    }
  }
  if ($this->query['filters']) {
    $filters =& $query
      ->getFilter()
      ->getFilters();
    $filters = $this->query['filters'];
  }
  return $query;
}