protected function SearchApiElasticsearchQuery::setAggregationOptions in Search API Elasticsearch 7.2
Configure an aggregation.
Parameters
AbstractSimpleAggregation $aggregation:
$field_type:
$aggregation_info:
1 call to SearchApiElasticsearchQuery::setAggregationOptions()
- SearchApiElasticsearchQuery::addAggregations in includes/
SearchApiElasticsearchQuery.inc - Add aggregations to an Elasticsearch query.
File
- includes/
SearchApiElasticsearchQuery.inc, line 281
Class
Code
protected function setAggregationOptions(AbstractSimpleAggregation $aggregation, $field_type, $aggregation_info) {
$aggregation_limit = $this
->getAggregationLimit($aggregation_info);
$aggregation_filter = $this
->getAggregationFilter($aggregation_info, $field_type);
if (!empty($aggregation_filter)) {
$filter = new Filter($aggregation_info['field']);
$filter
->setFilter($aggregation_filter);
$aggregation
->addAggregation($filter);
}
if ($aggregation_limit > 0 && method_exists($aggregation, 'setSize')) {
$aggregation
->setSize($aggregation_limit);
}
$aggregation
->setField($aggregation_info['field']);
}