simplify methods
This commit is contained in:
parent
791c5ddd7e
commit
a54798354b
|
@ -118,7 +118,7 @@ class NestedAggregator extends BucketsAggregator implements SingleBucketAggregat
|
||||||
|
|
||||||
private void processBufferedDocs() throws IOException {
|
private void processBufferedDocs() throws IOException {
|
||||||
if (bufferingNestedLeafBucketCollector != null) {
|
if (bufferingNestedLeafBucketCollector != null) {
|
||||||
bufferingNestedLeafBucketCollector.postCollect();
|
bufferingNestedLeafBucketCollector.processBufferedChildBuckets();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,27 +158,27 @@ class NestedAggregator extends BucketsAggregator implements SingleBucketAggregat
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentParentDoc != parentDoc) {
|
if (currentParentDoc != parentDoc) {
|
||||||
processChildBuckets(currentParentDoc, bucketBuffer);
|
processBufferedChildBuckets();
|
||||||
currentParentDoc = parentDoc;
|
currentParentDoc = parentDoc;
|
||||||
}
|
}
|
||||||
bucketBuffer.add(bucket);
|
bucketBuffer.add(bucket);
|
||||||
}
|
}
|
||||||
|
|
||||||
void processChildBuckets(int parentDoc, LongArrayList buckets) throws IOException {
|
void processBufferedChildBuckets() throws IOException {
|
||||||
if (bucketBuffer.isEmpty()) {
|
if (bucketBuffer.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
final int prevParentDoc = parentDocs.prevSetBit(parentDoc - 1);
|
final int prevParentDoc = parentDocs.prevSetBit(currentParentDoc - 1);
|
||||||
int childDocId = childDocs.docID();
|
int childDocId = childDocs.docID();
|
||||||
if (childDocId <= prevParentDoc) {
|
if (childDocId <= prevParentDoc) {
|
||||||
childDocId = childDocs.advance(prevParentDoc + 1);
|
childDocId = childDocs.advance(prevParentDoc + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; childDocId < parentDoc; childDocId = childDocs.nextDoc()) {
|
for (; childDocId < currentParentDoc; childDocId = childDocs.nextDoc()) {
|
||||||
final long[] buffer = buckets.buffer;
|
final long[] buffer = bucketBuffer.buffer;
|
||||||
final int size = buckets.size();
|
final int size = bucketBuffer.size();
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
collectBucket(sub, childDocId, buffer[i]);
|
collectBucket(sub, childDocId, buffer[i]);
|
||||||
}
|
}
|
||||||
|
@ -186,10 +186,6 @@ class NestedAggregator extends BucketsAggregator implements SingleBucketAggregat
|
||||||
bucketBuffer.clear();
|
bucketBuffer.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void postCollect() throws IOException {
|
|
||||||
processChildBuckets(currentParentDoc, bucketBuffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue