bugmakerrrrrr commented on code in PR #15511:
URL: https://github.com/apache/lucene/pull/15511#discussion_r2639946309


##########
lucene/core/src/java/org/apache/lucene/search/comparators/TermOrdValComparator.java:
##########
@@ -599,4 +624,42 @@ private void init(int minOrd, int maxOrd) throws 
IOException {
       disjunction.addAll(postings);
     }
   }
+
+  private class SkipperBasedCompetitiveState extends CompetitiveState {
+    private final DocValuesSkipper skipper;
+    private final TwoPhaseIterator innerTwoPhase;
+    private int minOrd;
+    private int maxOrd;
+
+    SkipperBasedCompetitiveState(LeafReaderContext context, DocValuesSkipper 
skipper)
+        throws IOException {
+      super(context);
+      this.skipper = skipper;
+      this.iterator.update(DocIdSetIterator.all(context.reader().maxDoc()));
+      final SortedDocValues docValues = getSortedDocValues(context, field);
+      this.innerTwoPhase =
+          new TwoPhaseIterator(docValues) {
+            @Override
+            public boolean matches() throws IOException {
+              final int cur = docValues.ordValue();
+              return cur >= minOrd && cur <= maxOrd;
+            }
+
+            @Override
+            public float matchCost() {
+              return 2;
+            }
+          };
+    }
+
+    @Override
+    public void update(int minOrd, int maxOrd) throws IOException {
+      this.minOrd = minOrd;
+      this.maxOrd = maxOrd;
+
+      final TwoPhaseIterator twoPhaseIterator =
+          new DocValuesRangeIterator(innerTwoPhase, skipper, minOrd, maxOrd, 
false);

Review Comment:
   I had the same thought. When I implemented this, I considered whether 
approximation could serve as a competitive iterator, but I haven't figured out 
when to do that.



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