Bool Filter fails with ArrayIndexOutOfBoundsException, closes #1419.

This commit is contained in:
Shay Banon 2011-10-24 00:30:30 +02:00
parent d8f426a166
commit dec8dc5bec
1 changed files with 6 additions and 5 deletions

View File

@ -79,14 +79,15 @@ public class DocSets {
if (disi == null) {
into.clear(0, into.length());
} else {
int bitSetDoc = into.nextSetBit(0);
int disiDoc;
while (bitSetDoc != -1 && (disiDoc = disi.advance(bitSetDoc)) != DocIdSetIterator.NO_MORE_DOCS) {
int numBits = into.length();
int disiDoc, bitSetDoc = into.nextSetBit(0);
while (bitSetDoc != -1 && (disiDoc = disi.advance(bitSetDoc)) < numBits) {
into.clear(bitSetDoc, disiDoc);
bitSetDoc = into.nextSetBit(disiDoc + 1);
disiDoc++;
bitSetDoc = (disiDoc < numBits) ? into.nextSetBit(disiDoc) : -1;
}
if (bitSetDoc != -1) {
into.clear(bitSetDoc, into.length());
into.clear(bitSetDoc, numBits);
}
}
}