LUCENE-3448: Make optimization for OpenBitSetIterator correctly exhaust iterator

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1204416 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2011-11-21 09:46:30 +00:00
parent 2a68764f72
commit 66ab542f2f
1 changed files with 9 additions and 0 deletions

View File

@ -192,6 +192,9 @@ public final class FixedBitSet extends DocIdSet implements Bits {
if (iter instanceof OpenBitSetIterator && iter.docID() == -1) {
final OpenBitSetIterator obs = (OpenBitSetIterator) iter;
or(obs.arr, obs.words);
// advance after last doc that would be accepted if standard
// iteration is used (to exhaust it):
obs.advance(numBits);
} else {
int doc;
while ((doc = iter.nextDoc()) < numBits) {
@ -219,6 +222,9 @@ public final class FixedBitSet extends DocIdSet implements Bits {
if (iter instanceof OpenBitSetIterator && iter.docID() == -1) {
final OpenBitSetIterator obs = (OpenBitSetIterator) iter;
and(obs.arr, obs.words);
// advance after last doc that would be accepted if standard
// iteration is used (to exhaust it):
obs.advance(numBits);
} else {
if (numBits == 0) return;
int disiDoc, bitSetDoc = nextSetBit(0);
@ -255,6 +261,9 @@ public final class FixedBitSet extends DocIdSet implements Bits {
if (iter instanceof OpenBitSetIterator && iter.docID() == -1) {
final OpenBitSetIterator obs = (OpenBitSetIterator) iter;
andNot(obs.arr, obs.words);
// advance after last doc that would be accepted if standard
// iteration is used (to exhaust it):
obs.advance(numBits);
} else {
int doc;
while ((doc = iter.nextDoc()) < numBits) {