@@ 116-141 (lines=26) @@ | ||
113 | * |
|
114 | * @return BuilderInterface |
|
115 | */ |
|
116 | protected function addSubFilterAggregation( |
|
117 | $filterAggregation, |
|
118 | $deepLevelAggregation, |
|
119 | $terms, |
|
120 | $aggName |
|
121 | ) { |
|
122 | list($path, $field) = explode('>', $this->getField()); |
|
123 | $boolQuery = new BoolQuery(); |
|
124 | ||
125 | foreach ($terms as $namedTerms) { |
|
126 | $boolQuery->add( |
|
127 | new NestedQuery($path, new TermsQuery($field, array_values($namedTerms))) |
|
128 | ); |
|
129 | } |
|
130 | ||
131 | if ($boolQuery->getQueries() == []) { |
|
132 | $boolQuery->add(new MatchAllQuery()); |
|
133 | } |
|
134 | ||
135 | $innerFilterAggregation = new FilterAggregation( |
|
136 | $aggName, |
|
137 | $boolQuery |
|
138 | ); |
|
139 | $innerFilterAggregation->addAggregation($deepLevelAggregation); |
|
140 | $filterAggregation->addAggregation($innerFilterAggregation); |
|
141 | } |
|
142 | ||
143 | /** |
|
144 | * @param string $key |
@@ 331-356 (lines=26) @@ | ||
328 | * |
|
329 | * @return BuilderInterface |
|
330 | */ |
|
331 | protected function addSubFilterAggregation( |
|
332 | $filterAggregation, |
|
333 | $deepLevelAggregation, |
|
334 | $terms, |
|
335 | $aggName |
|
336 | ) { |
|
337 | list($path, $field) = explode('>', $this->getField()); |
|
338 | $boolQuery = new BoolQuery(); |
|
339 | ||
340 | foreach ($terms as $term) { |
|
341 | $boolQuery->add( |
|
342 | new NestedQuery($path, new TermQuery($field, $term)) |
|
343 | ); |
|
344 | } |
|
345 | ||
346 | if ($boolQuery->getQueries() == []) { |
|
347 | $boolQuery->add(new MatchAllQuery()); |
|
348 | } |
|
349 | ||
350 | $innerFilterAggregation = new FilterAggregation( |
|
351 | $aggName, |
|
352 | $boolQuery |
|
353 | ); |
|
354 | $innerFilterAggregation->addAggregation($deepLevelAggregation); |
|
355 | $filterAggregation->addAggregation($innerFilterAggregation); |
|
356 | } |
|
357 | ||
358 | /** |
|
359 | * @param string $key |