msokolov commented on code in PR #14996:
URL: https://github.com/apache/lucene/pull/14996#discussion_r2242295341


##########
lucene/core/src/java/org/apache/lucene/index/SoftDeletesDirectoryReaderWrapper.java:
##########
@@ -188,11 +189,11 @@ private static boolean assertDocCounts(
 
   static final class SoftDeletesFilterLeafReader extends FilterLeafReader {
     private final LeafReader reader;
-    private final FixedBitSet bits;
+    private final Bits bits;
     private final int numDocs;
     private final CacheHelper readerCacheHelper;
 
-    private SoftDeletesFilterLeafReader(LeafReader reader, FixedBitSet bits, 
int numDocs) {
+    private SoftDeletesFilterLeafReader(LeafReader reader, Bits bits, int 
numDocs) {

Review Comment:
   curious why we are changing these signatures - it seems the call sites still 
always use FixedBitSet?



##########
lucene/core/src/java/org/apache/lucene/util/FixedBits.java:
##########
@@ -31,8 +33,17 @@ public boolean get(int index) {
   }
 
   @Override
-  public void applyMask(FixedBitSet dest, int offset) {
-    bitSet.applyMask(dest, offset);
+  public void applyMask(FixedBitSet bitSet, int offset) {
+    // Note: Some scorers don't track maxDoc and may thus call this method 
with an offset that is
+    // beyond bitSet.length()
+    int length = Math.min(bitSet.length(), length() - offset);
+    if (length >= 0) {
+      FixedBitSet.andRange(this.bitSet, offset, bitSet, 0, length);
+    }
+    if (length < bitSet.length()
+        && bitSet.nextSetBit(Math.max(0, length)) != 
DocIdSetIterator.NO_MORE_DOCS) {
+      throw new IllegalArgumentException("Some bits are set beyond the end of 
live docs");

Review Comment:
   this comment refers to "live docs" but the method is generic and could apply 
to other kinds of bit set applications - maybe change to "beyond the end of the 
bit set"?



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