kkewwei commented on code in PR #16835:
URL: https://github.com/apache/lucene/pull/16835#discussion_r4322596039


##########
lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90DocValuesProducer.java:
##########
@@ -1123,6 +1151,37 @@ public long longValue() throws IOException {
               public long longValue() throws IOException {
                 return table[(int) values.get(disi.index())];
               }
+
+              @Override
+              public void rangeIntoBitSet(
+                  int fromDoc,
+                  int toDoc,
+                  long minValue,
+                  long maxValue,
+                  FixedBitSet bitSet,
+                  int offset)
+                  throws IOException {
+                int endDoc = Math.min(toDoc, maxDoc);
+                if (fromDoc >= endDoc) {
+                  return;
+                }
+                long[] bounds = transformTableBounds(table, minValue, 
maxValue);
+                if (bounds == null || fromDoc >= endDoc) {
+                  return;
+                }
+                int currentDoc = disi.docID();
+                if (currentDoc < fromDoc) {
+                  currentDoc = disi.advance(fromDoc);
+                } else if (currentDoc < endDoc && 
disi.advanceExact(currentDoc) == false) {
+                  currentDoc = disi.nextDoc();
+                }
+                for (; currentDoc < endDoc; currentDoc = disi.nextDoc()) {

Review Comment:
   Thanks for pointing this out. It looks like there are two possible 
optimization directions:
   
   1. For `sparse` DocValues, iterate only over documents that have values 
via`disi.nextDoc()` , instead of checking every doc with`advanceExact()` .
   2. For `dense` DocValues, add specialized`rangeIntoBitSet` overrides for the 
remaining encodings.
   
   If that sounds reasonable, I’d be happy to address these in a follow-up PR.



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