Also short circuit within segment when score mode is avg

This commit is contained in:
Martijn van Groningen 2013-12-01 16:44:19 +01:00
parent ac1e985670
commit 1285894f5f
1 changed files with 10 additions and 0 deletions

View File

@ -338,6 +338,11 @@ public class ChildrenQuery extends Query {
@Override
public int nextDoc() throws IOException {
if (remaining == 0) {
currentDocId = NO_MORE_DOCS;
return NO_MORE_DOCS;
}
while (true) {
currentDocId = parentsIterator.nextDoc();
if (currentDocId == DocIdSetIterator.NO_MORE_DOCS) {
@ -356,6 +361,11 @@ public class ChildrenQuery extends Query {
@Override
public int advance(int target) throws IOException {
if (remaining == 0) {
currentDocId = NO_MORE_DOCS;
return NO_MORE_DOCS;
}
currentDocId = parentsIterator.advance(target);
if (currentDocId == DocIdSetIterator.NO_MORE_DOCS) {
return currentDocId;