Skip to content

Commit

Permalink
Fix test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
jpountz committed Dec 23, 2024
1 parent 1720dc0 commit 0f5943e
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions lucene/core/src/java/org/apache/lucene/util/FixedBitSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -342,17 +342,31 @@ public void or(DocIdSetIterator iter) throws IOException {
// TODO: implement DocBaseBitSetIterator#intoBitSet instead
checkUnpositioned(iter);
DocBaseBitSetIterator baseIter = (DocBaseBitSetIterator) iter;
orRange(baseIter.getBitSet(), baseIter.getDocBase());
or(baseIter.getDocBase() >> 6, baseIter.getBitSet());
} else {
checkUnpositioned(iter);
iter.nextDoc();
iter.intoBitSet(null, DocIdSetIterator.NO_MORE_DOCS, this, 0);
}
}

private void or(final int otherOffsetWords, FixedBitSet other) {
or(otherOffsetWords, other.bits, other.numWords);
}

private void or(final int otherOffsetWords, final long[] otherArr, final int otherNumWords) {
assert otherNumWords + otherOffsetWords <= numWords
: "numWords=" + numWords + ", otherNumWords=" + otherNumWords;
int pos = Math.min(numWords - otherOffsetWords, otherNumWords);
final long[] thisArr = this.bits;
while (--pos >= 0) {
thisArr[pos + otherOffsetWords] |= otherArr[pos];
}
}

/**
* Or {@code min(length(), other.length() - from} bits starting at {@code from} from {@code other}
* into this bit set.
* into this bit set starting at 0.
*/
void orRange(FixedBitSet other, int from) {
int numBits = Math.min(length(), other.length() - from);
Expand Down

0 comments on commit 0f5943e

Please sign in to comment.