iverase commented on a change in pull request #7:
URL: https://github.com/apache/lucene/pull/7#discussion_r728840833



##########
File path: lucene/core/src/java/org/apache/lucene/index/PointValues.java
##########
@@ -227,8 +228,56 @@ protected PointValues() {}
     CELL_CROSSES_QUERY
   };
 
+  /** Create a new {@link IndexTree} to navigate the index */
+  public abstract IndexTree getIndexTree() throws IOException;
+
+  /**
+   * Basic operations to read the KD-tree.
+   *
+   * @lucene.experimental
+   */
+  public interface IndexTree extends Cloneable {
+
+    /** Clone, the current node becomes the root of the new tree. */
+    IndexTree clone();
+
+    /**
+     * Move to the first child node and return {@code true} upon success. 
Returns {@code false} for
+     * leaf nodes and {@code true} otherwise. Should not be called if the 
current node has already
+     * called this method.

Review comment:
       This is a method that visit the tree from left to right:
   
   ```
   private void iterateTree(PointValues.PointTree pointTree) throws IOException 
{
       if (pointTree.moveToChild()) {
         do {
           iterateTree(pointTree);
         } while (pointTree.moveToSibling());
         pointTree.moveToParent();
       } else {
         // stop iteration
       }
     }
   ```
   
   It is easy to prove that if you perform the following movement (moveToChild 
= true) :
   
   ```
    pointTree.moveToChild();
    pointTree.moveToParent();
   ```
   
   or the following movement:
   
   ```
       pointTree.moveToChild();
       pointTree.moveToSibling();
       pointTree.moveToParent();
   ```
   
   and then you try to iterate the tree, you get an error. 
   
   You can only move in the tree forward so the method should never be called 
after calling successfully moveToParent()?
   
   




-- 
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: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to