You are here

public function SearchApiQuery::preExecute in Search API 7

Prepares the query object for the search.

This method should always be called by execute() and contain all necessary operations before the query is passed to the server's search() method.

Throws

SearchApiException If any error occurred during the preparation of the query.

Overrides SearchApiQueryInterface::preExecute

1 call to SearchApiQuery::preExecute()
SearchApiQuery::execute in includes/query.inc
Executes this search query.

File

includes/query.inc, line 713
Contains SearchApiQueryInterface and SearchApiQuery.

Class

SearchApiQuery
Provides a standard implementation of the SearchApiQueryInterface.

Code

public function preExecute() {

  // Make sure to only execute this once per query.
  if (!$this->pre_execute) {
    $this->pre_execute = TRUE;

    // Add filter for languages.
    if (isset($this->options['languages'])) {
      $this
        ->addLanguages($this->options['languages']);
    }

    // Add fulltext fields, unless set
    if ($this->fields === NULL) {
      $this->fields = $this->index
        ->getFulltextFields();
    }

    // Preprocess query.
    $this->index
      ->preprocessSearchQuery($this);

    // Let modules alter the query.
    drupal_alter('search_api_query', $this);
  }
}