public function SearchApiQuery::setOption in Search API 8
Sets an option for this search query.
Parameters
string $name: The name of an option. The following options are recognized by default:
- offset: The position of the first returned search results relative to the whole result in the index.
- limit: The maximum number of search results to return. -1 means no limit.
- 'search id': A string that will be used as the identifier when storing this search in the Search API's static cache.
- 'skip result count': If present and set to TRUE, the search's result count will not be needed. Service classes can check for this option to possibly avoid executing expensive operations to compute the result count in cases where it is not needed.
- search_api_access_account: The account which will be used for entity access checks, if available and enabled for the index.
- search_api_bypass_access: If set to TRUE, entity access checks will be skipped, even if enabled for the index.
However, contrib modules might introduce arbitrary other keys with their own, special meaning. (Usually they should be prefixed with the module name, though, to avoid conflicts.)
mixed $value: The new value of the option.
Return value
mixed The option's previous value, or NULL if none was set.
See also
\Drupal\search_api\Query\QueryInterface::setOption()
1 call to SearchApiQuery::setOption()
- SearchApiQuery::addOrderBy in src/
Plugin/ views/ query/ SearchApiQuery.php - Adds an ORDER BY clause to the query.
File
- src/
Plugin/ views/ query/ SearchApiQuery.php, line 1477
Class
- SearchApiQuery
- Defines a Views query class for searching on Search API indexes.
Namespace
Drupal\search_api\Plugin\views\queryCode
public function setOption($name, $value) {
if (!$this
->shouldAbort()) {
return $this->query
->setOption($name, $value);
}
return NULL;
}