jpountz commented on a change in pull request #476:
URL: https://github.com/apache/lucene/pull/476#discussion_r756919845



##########
File path: lucene/core/src/java/org/apache/lucene/util/bkd/BKDReader.java
##########
@@ -297,11 +301,20 @@ public boolean moveToChild() throws IOException {
       if (isLeafNode()) {
         return false;
       }
+      maybeResetNodeDataPosition();
       pushBoundsLeft();
       pushLeft();
       return true;
     }
 
+    private void maybeResetNodeDataPosition() throws IOException {
+      if (readNodeDataPositions[level] != innerNodes.getFilePointer()) {
+        // move position of the inner nodes index in case we move to the first 
child
+        assert readNodeDataPositions[level] < innerNodes.getFilePointer();
+        innerNodes.seek(readNodeDataPositions[level]);
+      }

Review comment:
       seek should be cheap, I wonder if we could call it 
`resetNodeDataPosition()` and change the impl to call seek unconditionally?

##########
File path: lucene/core/src/java/org/apache/lucene/util/bkd/BKDReader.java
##########
@@ -515,15 +529,20 @@ public void addAll(PointValues.IntersectVisitor visitor, 
boolean grown) throws I
 
     @Override
     public void visitDocValues(PointValues.IntersectVisitor visitor) throws 
IOException {
+      maybeResetNodeDataPosition();
+      addOneByOne(visitor);
+    }
+
+    public void addOneByOne(PointValues.IntersectVisitor visitor) throws 
IOException {

Review comment:
       Maybe give it a more explicit name, e.g. `visitLeavesOneByOne`?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to