dnhatn commented on a change in pull request #1263: LUCENE-9228: Sort dv 
updates by terms by applying
URL: https://github.com/apache/lucene-solr/pull/1263#discussion_r380734250
 
 

 ##########
 File path: 
lucene/core/src/java/org/apache/lucene/index/FrozenBufferedUpdates.java
 ##########
 @@ -808,10 +808,17 @@ private void setField(String field) throws IOException {
         } else {
           termsEnum = null;
         }
+        currentTermVisited = false;
       }
     }
 
-    DocIdSetIterator nextTerm(String field, BytesRef term) throws IOException {
+    /**
+     * Returns a {@link DocIdSetIterator} for the given field and term if 
exists. If the parameter
+     * {@code skipIfTermVisited} is true, then this method will return null if 
the given and field
+     * was visited already. This optimization is currently used in
+     * {@link #applyDocValuesUpdates(BufferedUpdatesStream.SegmentState, Map, 
long, boolean)}
+     */
+    DocIdSetIterator nextTerm(String field, BytesRef term, boolean 
skipIfTermVisited) throws IOException {
 
 Review comment:
   It's doable and more contained than the current approach, but there are two 
downsides with it. We need to compare the current term and the last term. Here, 
we don't have to as we re-use the comparison between the reader term and the 
current term. We also need to maintain an extra iterator for the last term as 
we set BytesRef when iterating terms. I am happy to make this change if you 
think the comparison cost is not significant.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

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

Reply via email to