protected function SearchApiMultiQuery::addLanguages in Search API Multi-Index Searches 7
Helper method for adding a language filter.
Parameters
array $languages: The languages which the query should include.
1 call to SearchApiMultiQuery::addLanguages()
- SearchApiMultiQuery::preExecute in ./
search_api_multi.query.inc - Pre-execute hook for modifying search behaviour.
File
- ./
search_api_multi.query.inc, line 724
Class
- SearchApiMultiQuery
- Standard implementation of SearchApiMultiQueryInterface.
Code
protected function addLanguages(array $languages) {
if (array_search(LANGUAGE_NONE, $languages) === FALSE) {
$languages[] = LANGUAGE_NONE;
}
$filter = $this
->createFilter('OR');
foreach ($languages as $lang) {
foreach ($this->indexes as $index_id => $index) {
$filter
->condition("{$index_id}:search_api_language", $lang);
}
}
$this
->filter($filter);
}