@@ 301-306 (lines=6) @@ | ||
298 | list($path, $field) = explode('>', $this->getField()); |
|
299 | $boolQuery = new BoolQuery(); |
|
300 | ||
301 | foreach ($terms as $groupName => $term) { |
|
302 | $nestedBoolQuery = new BoolQuery(); |
|
303 | $nestedBoolQuery->add(new TermQuery($field, $term)); |
|
304 | $nestedBoolQuery->add(new TermQuery($this->getNameField(), $groupName)); |
|
305 | $boolQuery->add(new NestedQuery($path, $nestedBoolQuery)); |
|
306 | } |
|
307 | ||
308 | $boolQuery = !empty($boolQuery->getQueries()) ? $boolQuery : new MatchAllQuery(); |
|
309 | $innerFilterAggregation = new FilterAggregation($aggName, $boolQuery); |
@@ 146-157 (lines=12) @@ | ||
143 | foreach ($terms as $groupName => $values) { |
|
144 | $innerBoolQuery = new BoolQuery(); |
|
145 | ||
146 | foreach ($values as $value) { |
|
147 | $nestedBoolQuery = new BoolQuery(); |
|
148 | $nestedBoolQuery->add(new TermQuery($field, $value)); |
|
149 | $nestedBoolQuery->add(new TermQuery($this->getNameField(), $groupName)); |
|
150 | $innerBoolQuery->add( |
|
151 | new NestedQuery( |
|
152 | $path, |
|
153 | $nestedBoolQuery |
|
154 | ), |
|
155 | BoolQuery::SHOULD |
|
156 | ); |
|
157 | } |
|
158 | ||
159 | $boolQuery->add($innerBoolQuery); |
|
160 | } |