@@ 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 |
@@ 298-321 (lines=24) @@ | ||
295 | * |
|
296 | * @return array Buckets. |
|
297 | */ |
|
298 | protected function fetchAggregation(DocumentIterator $result, $filterName, $values) |
|
299 | { |
|
300 | $data = []; |
|
301 | $aggregation = $result->getAggregation(sprintf('%s-filter', $filterName)); |
|
302 | ||
303 | if ($aggregation->getAggregation($filterName)) { |
|
304 | $aggregation = $aggregation->find($filterName.'.query'); |
|
305 | $data['all-selected'] = $aggregation; |
|
306 | ||
307 | return $data; |
|
308 | } |
|
309 | ||
310 | if (!empty($values)) { |
|
311 | foreach ($values as $name => $value) { |
|
312 | $data[$name] = $aggregation->find(sprintf('%s.%s.query', $name, $filterName)); |
|
313 | } |
|
314 | ||
315 | $data['all-selected'] = $aggregation->find(sprintf('all-selected.%s.query', $filterName)); |
|
316 | ||
317 | return $data; |
|
318 | } |
|
319 | ||
320 | return []; |
|
321 | } |
|
322 | ||
323 | /** |
|
324 | * A method used to add an additional filter to the aggregations |