@@ 82-107 (lines=26) @@ | ||
79 | * |
|
80 | * @return BuilderInterface |
|
81 | */ |
|
82 | protected function addSubFilterAggregation( |
|
83 | $filterAggregation, |
|
84 | $deepLevelAggregation, |
|
85 | $terms, |
|
86 | $aggName |
|
87 | ) { |
|
88 | list($path, $field) = explode('>', $this->getField()); |
|
89 | $boolQuery = new BoolQuery(); |
|
90 | ||
91 | foreach ($terms as $namedTerms) { |
|
92 | $boolQuery->add( |
|
93 | new NestedQuery($path, new TermsQuery($field, array_values($namedTerms))) |
|
94 | ); |
|
95 | } |
|
96 | ||
97 | if ($boolQuery->getQueries() == []) { |
|
98 | $boolQuery->add(new MatchAllQuery()); |
|
99 | } |
|
100 | ||
101 | $innerFilterAggregation = new FilterAggregation( |
|
102 | $aggName, |
|
103 | $boolQuery |
|
104 | ); |
|
105 | $innerFilterAggregation->addAggregation($deepLevelAggregation); |
|
106 | $filterAggregation->addAggregation($innerFilterAggregation); |
|
107 | } |
|
108 | ||
109 | /** |
|
110 | * @param string $key |
@@ 322-347 (lines=26) @@ | ||
319 | * |
|
320 | * @return BuilderInterface |
|
321 | */ |
|
322 | protected function addSubFilterAggregation( |
|
323 | $filterAggregation, |
|
324 | $deepLevelAggregation, |
|
325 | $terms, |
|
326 | $aggName |
|
327 | ) { |
|
328 | list($path, $field) = explode('>', $this->getField()); |
|
329 | $boolQuery = new BoolQuery(); |
|
330 | ||
331 | foreach ($terms as $term) { |
|
332 | $boolQuery->add( |
|
333 | new NestedQuery($path, new TermQuery($field, $term)) |
|
334 | ); |
|
335 | } |
|
336 | ||
337 | if ($boolQuery->getQueries() == []) { |
|
338 | $boolQuery->add(new MatchAllQuery()); |
|
339 | } |
|
340 | ||
341 | $innerFilterAggregation = new FilterAggregation( |
|
342 | $aggName, |
|
343 | $boolQuery |
|
344 | ); |
|
345 | $innerFilterAggregation->addAggregation($deepLevelAggregation); |
|
346 | $filterAggregation->addAggregation($innerFilterAggregation); |
|
347 | } |
|
348 | ||
349 | /** |
|
350 | * @param string $key |