simplify methods

This commit is contained in:
Martijn van Groningen 2017-12-21 19:42:32 +01:00
parent 791c5ddd7e
commit a54798354b
No known key found for this signature in database
GPG Key ID: AB236F4FCF2AF12A
1 changed files with 7 additions and 11 deletions

View File

@ -118,7 +118,7 @@ class NestedAggregator extends BucketsAggregator implements SingleBucketAggregat
private void processBufferedDocs() throws IOException {
if (bufferingNestedLeafBucketCollector != null) {
bufferingNestedLeafBucketCollector.postCollect();
bufferingNestedLeafBucketCollector.processBufferedChildBuckets();
}
}
@ -158,27 +158,27 @@ class NestedAggregator extends BucketsAggregator implements SingleBucketAggregat
}
if (currentParentDoc != parentDoc) {
processChildBuckets(currentParentDoc, bucketBuffer);
processBufferedChildBuckets();
currentParentDoc = parentDoc;
}
bucketBuffer.add(bucket);
}
void processChildBuckets(int parentDoc, LongArrayList buckets) throws IOException {
void processBufferedChildBuckets() throws IOException {
if (bucketBuffer.isEmpty()) {
return;
}
final int prevParentDoc = parentDocs.prevSetBit(parentDoc - 1);
final int prevParentDoc = parentDocs.prevSetBit(currentParentDoc - 1);
int childDocId = childDocs.docID();
if (childDocId <= prevParentDoc) {
childDocId = childDocs.advance(prevParentDoc + 1);
}
for (; childDocId < parentDoc; childDocId = childDocs.nextDoc()) {
final long[] buffer = buckets.buffer;
final int size = buckets.size();
for (; childDocId < currentParentDoc; childDocId = childDocs.nextDoc()) {
final long[] buffer = bucketBuffer.buffer;
final int size = bucketBuffer.size();
for (int i = 0; i < size; i++) {
collectBucket(sub, childDocId, buffer[i]);
}
@ -186,10 +186,6 @@ class NestedAggregator extends BucketsAggregator implements SingleBucketAggregat
bucketBuffer.clear();
}
void postCollect() throws IOException {
processChildBuckets(currentParentDoc, bucketBuffer);
}
}
}