@@ 309-334 (lines=26) @@ | ||
306 | * |
|
307 | * @return BuilderInterface |
|
308 | */ |
|
309 | protected function addSubFilterAggregation( |
|
310 | $filterAggregation, |
|
311 | $deepLevelAggregation, |
|
312 | $terms, |
|
313 | $aggName |
|
314 | ) { |
|
315 | list($path, $field) = explode('>', $this->getField()); |
|
316 | $boolQuery = new BoolQuery(); |
|
317 | ||
318 | foreach ($terms as $term) { |
|
319 | $boolQuery->add( |
|
320 | new NestedQuery($path, new TermQuery($field, $term)) |
|
321 | ); |
|
322 | } |
|
323 | ||
324 | if ($boolQuery->getQueries() == []) { |
|
325 | $boolQuery->add(new MatchAllQuery()); |
|
326 | } |
|
327 | ||
328 | $innerFilterAggregation = new FilterAggregation( |
|
329 | $aggName, |
|
330 | $boolQuery |
|
331 | ); |
|
332 | $innerFilterAggregation->addAggregation($deepLevelAggregation); |
|
333 | $filterAggregation->addAggregation($innerFilterAggregation); |
|
334 | } |
|
335 | ||
336 | /** |
|
337 | * @param string $key |
@@ 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 |