public function SearchApiViewsQuery::add_selector_orderby in Search API 7
Adds a sort to the query.
Parameters
string $selector: The field to sort on. All indexed fields of the index are valid values. In addition, these special fields may be used:
- search_api_relevance: sort by relevance;
- search_api_id: sort by item id;
- search_api_random: random sort (available only if the server supports the "search_api_random_sort" feature).
string $order: The order to sort items in - either 'ASC' or 'DESC'. Defaults to 'ASC'.
1 call to SearchApiViewsQuery::add_selector_orderby()
- SearchApiViewsQuery::add_orderby in contrib/
search_api_views/ includes/ query.inc - Provides a sorting method as present in the Views default query plugin.
File
- contrib/
search_api_views/ includes/ query.inc, line 137 - Contains SearchApiViewsQuery.
Class
- SearchApiViewsQuery
- Views query class using a Search API index as the data source.
Code
public function add_selector_orderby($selector, $order = 'ASC') {
if (!$this->errors) {
$this->query
->sort($selector, $order);
}
}