final public function SearchApiMultiQuery::execute in Search API Multi-Index Searches 7
Implements SearchApiMultiQueryInterface::execute().
Uses a server's searchMultiple() method, where possible.
Overrides SearchApiMultiQueryInterface::execute
File
- ./
search_api_multi.query.inc, line 681
Class
- SearchApiMultiQuery
- Standard implementation of SearchApiMultiQueryInterface.
Code
public final function execute() {
$start = microtime(TRUE);
// Call pre-execute hook.
$this
->preExecute();
// Let modules alter the query.
drupal_alter('search_api_multi_query', $this);
$pre_search = microtime(TRUE);
// Execute query.
if (count($this->servers) == 1) {
$server = search_api_server_load(key($this->servers));
if ($server && $server
->supportsFeature('search_api_multi')) {
$response = $server
->searchMultiple($this);
}
}
if (!isset($response)) {
$response = $this
->searchMultiple();
}
$post_search = microtime(TRUE);
// Call post-execute hook.
$this
->postExecute($response);
$end = microtime(TRUE);
$response['performance']['complete'] = $end - $start;
$response['performance']['hooks'] = $response['performance']['complete'] - ($post_search - $pre_search);
// Store search for later retrieval for facets, etc.
search_api_multi_current_search(NULL, $this, $response);
return $response;
}