You are here

public function QueryInterface::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.
  • '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.
  • search_api_retrieved_field_values: A list of IDs of fields whose values should be returned along with the results by the backend, if possible. For backends that support retrieving fields values, this allows them to only retrieve the values that are actually needed.

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.

1 method overrides QueryInterface::setOption()
Query::setOption in src/Query/Query.php
Sets an option for this search query.

File

src/Query/QueryInterface.php, line 447

Class

QueryInterface
Represents a search query on a Search API index.

Namespace

Drupal\search_api\Query

Code

public function setOption($name, $value);