public function SearchApiQuery::query in Search API 8
Generate a query and a countquery from all of the information supplied to the object.
Parameters
$get_count: Provide a countquery if this is true, otherwise provide a normal query.
Overrides QueryPluginBase::query
File
- src/
Plugin/ views/ query/ SearchApiQuery.php, line 438
Class
- SearchApiQuery
- Defines a Views query class for searching on Search API indexes.
Namespace
Drupal\search_api\Plugin\views\queryCode
public function query($get_count = FALSE) {
// Try to determine whether build() has been called yet.
if (empty($this->view->build_info['query'])) {
// If not, call it in case we at least have a view set. If we don't, we
// can't really do anything.
if (!$this->view) {
return NULL;
}
$this
->build($this->view);
}
$query = clone $this->query;
// A count query doesn't need to return any results.
if ($get_count) {
$query
->range(0, 0);
}
return $query;
}