| @@ 250-255 (lines=6) @@ | ||
| 247 | list($path, $field) = explode('>', $this->getDocumentField()); |
|
| 248 | $boolQuery = new BoolQuery(); |
|
| 249 | ||
| 250 | foreach ($terms as $groupName => $term) { |
|
| 251 | $nestedBoolQuery = new BoolQuery(); |
|
| 252 | $nestedBoolQuery->add(new TermQuery($field, $term)); |
|
| 253 | $nestedBoolQuery->add(new TermQuery($this->getNameField(), $groupName)); |
|
| 254 | $boolQuery->add(new NestedQuery($path, $nestedBoolQuery)); |
|
| 255 | } |
|
| 256 | ||
| 257 | $boolQuery = !empty($boolQuery->getQueries()) ? $boolQuery : new MatchAllQuery(); |
|
| 258 | $innerFilterAggregation = new FilterAggregation($aggName, $boolQuery); |
|
| @@ 143-154 (lines=12) @@ | ||
| 140 | foreach ($terms as $groupName => $values) { |
|
| 141 | $innerBoolQuery = new BoolQuery(); |
|
| 142 | ||
| 143 | foreach ($values as $value) { |
|
| 144 | $nestedBoolQuery = new BoolQuery(); |
|
| 145 | $nestedBoolQuery->add(new TermQuery($field, $value)); |
|
| 146 | $nestedBoolQuery->add(new TermQuery($this->getNameField(), $groupName)); |
|
| 147 | $innerBoolQuery->add( |
|
| 148 | new NestedQuery( |
|
| 149 | $path, |
|
| 150 | $nestedBoolQuery |
|
| 151 | ), |
|
| 152 | BoolQuery::SHOULD |
|
| 153 | ); |
|
| 154 | } |
|
| 155 | ||
| 156 | $boolQuery->add($innerBoolQuery); |
|
| 157 | } |
|