Added comments

This commit is contained in:
Mike Pellegrini 2024-09-11 15:27:24 -04:00
parent 09da5f42d9
commit a228bb7b7b
1 changed files with 5 additions and 0 deletions

View File

@ -242,6 +242,7 @@ public class ToParentBlockJoinQuery extends Query {
@Override
public int advance(int target) throws IOException {
// Look backwards to see if the current child doc matches the previous parent
final int prevParent =
target == 0 ? -1 : parentBits.prevSetBit(Math.min(target, parentBits.length()) - 1);
@ -265,6 +266,10 @@ public class ToParentBlockJoinQuery extends Query {
if (childDoc >= parentBits.length()) {
return doc = NO_MORE_DOCS;
}
// Get the current parent, starting at the current child doc. We do this to handle the case
// where the current child doc is also the current parent. When advance is next called, this
// will be detected and an exception will be thrown.
return doc = parentBits.nextSetBit(childDoc);
}