romseygeek commented on code in PR #16297:
URL: https://github.com/apache/lucene/pull/16297#discussion_r3805367351


##########
lucene/core/src/java/org/apache/lucene/search/DocValuesRangeIterator.java:
##########
@@ -145,27 +148,37 @@ boolean disjoint(DocValuesSkipper skipper) {
     }
   }
 
-  private static OrdinalSet buildOrdinalSet(TermsEnum termsEnum, long 
ordCount) throws IOException {
+  private static OrdinalSet buildOrdinalSet(TermsEnum termsEnum) throws 
IOException {
     if (termsEnum.next() == null) {
       return null;
     }
-    // TODO can we be more memory efficient here? eg LongHashSet
-    LongBitSet ords = new LongBitSet(ordCount);
     long min = termsEnum.ord();
-    ords.set(min);
     long max = min;
-    // Count distinct ords via getAndSet so a TermsEnum that yields a 
duplicate ord doesn't fool
-    // the contiguity check below. The first set bit (min) is always new on a 
fresh bitset.
+    long[] collected = new long[] {min};
+    int count = 1;
+    long prev = min;
     long distinctCount = 1;
     while (termsEnum.next() != null) {
-      max = termsEnum.ord();
-      if (ords.getAndSet(max) == false) {
+      long ord = termsEnum.ord();

Review Comment:
   Maybe worth preserving the comment (suitably reworded) about possible 
duplicate ords coming from a TermsEnum here?



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