public function Query::execute in Search API 8
Executes this search query.
The results of the search will be cached on the query, so subsequent calls of this method will always return the same result set (even if conditions were changed in between). If you want to re-execute a query, use getOriginalQuery().
Return value
\Drupal\search_api\Query\ResultSetInterface The results of the search.
Throws
\Drupal\search_api\SearchApiException Thrown if an error occurred during the search.
Overrides QueryInterface::execute
File
- src/
Query/ Query.php, line 519
Class
- Query
- Provides a standard implementation for a Search API query.
Namespace
Drupal\search_api\QueryCode
public function execute() {
if ($this
->hasExecuted()) {
return $this->results;
}
$this->executed = TRUE;
// Check for aborted status both before and after calling preExecute().
if ($this
->shouldAbort()) {
return $this->results;
}
// Prepare the query for execution by the server.
$this
->preExecute();
if ($this
->shouldAbort()) {
return $this->results;
}
// Execute query.
$this->index
->getServerInstance()
->search($this);
// Postprocess the search results.
$this
->postExecute();
return $this->results;
}