protected function SearchApiElasticsearchQuery::joinFilters in Search API Elasticsearch 7.2
Join Elasticsearch aggregation queries.
Parameters
$filters:
$conjunction:
Throws
Exception
1 call to SearchApiElasticsearchQuery::joinFilters()
- SearchApiElasticsearchQuery::parseFilter in includes/
SearchApiElasticsearchQuery.inc - Parse Search API filters.
File
- includes/
SearchApiElasticsearchQuery.inc, line 467
Class
Code
protected function joinFilters(&$filters, $conjunction) {
if (count($filters) > 1) {
if ($conjunction === 'OR') {
$query = new BoolQuery();
$query
->addShould($filters);
$filters = array(
$query,
);
}
elseif ($conjunction === 'AND') {
$query = new BoolQuery();
$query
->addMust($filters);
$filters = array(
$query,
);
}
else {
throw new Exception(t('Undefined conjunction :conjunction! Available values are "AND" and "OR"! Incorrect filter criteria is using for searching!', array(
':conjunction!' => $conjunction,
)));
}
}
}