You are here

public function SearchApiQueryInterface::__construct in Search API 7

Constructs a new search query.

Parameters

SearchApiIndex $index: The index the query should be executed on.

array $options: Associative array of options configuring this query. Recognized options are:

  • conjunction: The type of conjunction to use for this query - either 'AND' or 'OR'. 'AND' by default. This only influences the search keys, filters will always use AND by default.
  • 'parse mode': The mode with which to parse the $keys variable, if it is set and not already an array. See SearchApiQuery::parseModes() for recognized parse modes.
  • languages: The languages to search for, as an array of language IDs. If not specified, all languages will be searched. Language-neutral content (LANGUAGE_NONE) is always searched.
  • 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.
  • 'filter class': Can be used to change the SearchApiQueryFilterInterface implementation to use.
  • '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 result's "result count" key 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.

All options are optional. Third-party modules might define and use other options not listed here.

Throws

SearchApiException If a search on that index (or with those options) won't be possible.

1 method overrides SearchApiQueryInterface::__construct()
SearchApiQuery::__construct in includes/query.inc
Constructs a new search query.

File

includes/query.inc, line 55
Contains SearchApiQueryInterface and SearchApiQuery.

Class

SearchApiQueryInterface
Interface representing a search query on an Search API index.

Code

public function __construct(SearchApiIndex $index, array $options = array());