@@ 269-292 (lines=24) @@ | ||
266 | * |
|
267 | * @return array Buckets. |
|
268 | */ |
|
269 | protected function fetchAggregation(DocumentIterator $result, $filterName, $values) |
|
270 | { |
|
271 | $data = []; |
|
272 | $aggregation = $result->getAggregation(sprintf('%s-filter', $filterName)); |
|
273 | ||
274 | if ($aggregation->getAggregation($filterName)) { |
|
275 | $aggregation = $aggregation->find($filterName.'.query'); |
|
276 | $data['all-selected'] = $aggregation; |
|
277 | ||
278 | return $data; |
|
279 | } |
|
280 | ||
281 | if (!empty($values)) { |
|
282 | foreach ($values as $name => $value) { |
|
283 | $data[$name] = $aggregation->find(sprintf('%s.%s.query', $name, $filterName)); |
|
284 | } |
|
285 | ||
286 | $data['all-selected'] = $aggregation->find(sprintf('all-selected.%s.query', $filterName)); |
|
287 | ||
288 | return $data; |
|
289 | } |
|
290 | ||
291 | return []; |
|
292 | } |
|
293 | ||
294 | /** |
|
295 | * A method used to add an additional filter to the aggregations |
@@ 80-103 (lines=24) @@ | ||
77 | * |
|
78 | * @return array Buckets. |
|
79 | */ |
|
80 | protected function fetchAggregation(DocumentIterator $result, $filterName, $values) |
|
81 | { |
|
82 | $data = []; |
|
83 | $aggregation = $result->getAggregation(sprintf('%s-filter', $filterName)); |
|
84 | ||
85 | if ($aggregation->getAggregation($filterName)) { |
|
86 | $aggregation = $aggregation->find($filterName.'.query'); |
|
87 | $data['all-selected'] = $aggregation; |
|
88 | ||
89 | return $data; |
|
90 | } |
|
91 | ||
92 | if (!empty($values)) { |
|
93 | foreach ($values as $name => $value) { |
|
94 | $data[$name] = $aggregation->find(sprintf('%s.%s.query', $name, $filterName)); |
|
95 | } |
|
96 | ||
97 | $data['all-selected'] = $aggregation->find(sprintf('all-selected.%s.query', $filterName)); |
|
98 | ||
99 | return $data; |
|
100 | } |
|
101 | ||
102 | return []; |
|
103 | } |
|
104 | ||
105 | /** |
|
106 | * A method used to add an additional filter to the aggregations |