Skip to content

Commit

Permalink
Aggregations: Fix ReverseNestedAggregator to compute the parent docum…
Browse files Browse the repository at this point in the history
…ent correctly.

Close #6278
  • Loading branch information
jpountz committed May 22, 2014
1 parent 49f4903 commit bab0ac2
Showing 1 changed file with 6 additions and 1 deletion.
Expand Up @@ -105,7 +105,12 @@ public void collect(int childDoc, long bucketOrd) throws IOException {
}

// fast forward to retrieve the parentDoc this childDoc belongs to
int parentDoc = parentDocs.advance(childDoc);
final int parentDoc;
if (parentDocs.docID() < childDoc) {
parentDoc = parentDocs.advance(childDoc);
} else {
parentDoc = parentDocs.docID();
}
assert childDoc <= parentDoc && parentDoc != DocIdSetIterator.NO_MORE_DOCS;
if (bucketOrdToLastCollectedParentDoc.containsKey(bucketOrd)) {
int lastCollectedParentDoc = bucketOrdToLastCollectedParentDoc.lget();
Expand Down

0 comments on commit bab0ac2

Please sign in to comment.