jpountz commented on code in PR #13871:
URL: https://github.com/apache/lucene/pull/13871#discussion_r1792094616


##########
lucene/queries/src/java/org/apache/lucene/queries/intervals/OrderedIntervalsSource.java:
##########
@@ -124,38 +124,54 @@ public int nextInterval() throws IOException {
       start = end = slop = IntervalIterator.NO_MORE_INTERVALS;
       int lastStart = Integer.MAX_VALUE;
       boolean minimizing = false;
+      final var subIterators = this.subIterators;
+      int currentIndex = i;
       while (true) {
         while (true) {
-          if (subIterators.get(i - 1).end() >= lastStart) {
+          var prev = subIterators.get(currentIndex - 1);
+          if (prev.end() >= lastStart) {
+            i = currentIndex;

Review Comment:
   Nit: since we're extracting `i` to a local variable and then need to set it 
back before returning, it would make things a bit easier to read for me if we 
broke the outer loop instead of returning here (and in other places) and had a 
single return statement in the end.



-- 
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