public function SearchApiMultiQuery::__construct in Search API Multi-Index Searches 7
Constructs a new query object.
Parameters
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 SearchApiMultiQuery::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 on the server.
- 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 static cache.
All options are optional.
Throws
SearchApiException If a search with these options won't be possible.
Overrides SearchApiMultiQueryInterface::__construct
File
- ./
search_api_multi.query.inc, line 415
Class
- SearchApiMultiQuery
- Standard implementation of SearchApiMultiQueryInterface.
Code
public function __construct(array $options = array()) {
if (isset($options['parse mode'])) {
$modes = $this
->parseModes();
if (!isset($modes[$options['parse mode']])) {
throw new SearchApiException(t('Unknown parse mode: @mode.', array(
'@mode' => $options['parse mode'],
)));
}
}
$this->options = $options + array(
'conjunction' => 'AND',
'parse mode' => 'terms',
'filter class' => 'SearchApiQueryFilter',
'search id' => __CLASS__,
);
$this->filter = $this
->createFilter('AND');
$this->indexes = search_api_index_load_multiple(FALSE, array(
'enabled' => TRUE,
));
foreach ($this->indexes as $index_id => $index) {
$this->servers[$index->server][$index_id] = $index;
}
}