And/Or Filter: Possible failure when inner filter does not match any docs, closes #892.
This commit is contained in:
parent
413cbf1713
commit
fcdd2ba11c
|
@ -60,12 +60,21 @@ public class AndDocIdSet extends DocIdSet {
|
||||||
iterators = new DocIdSetIterator[sets.size()];
|
iterators = new DocIdSetIterator[sets.size()];
|
||||||
int j = 0;
|
int j = 0;
|
||||||
for (DocIdSet set : sets) {
|
for (DocIdSet set : sets) {
|
||||||
if (set != null) {
|
if (set == null) {
|
||||||
|
lastReturn = DocIdSetIterator.NO_MORE_DOCS; // non matching
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
DocIdSetIterator dcit = set.iterator();
|
DocIdSetIterator dcit = set.iterator();
|
||||||
|
if (dcit == null) {
|
||||||
|
lastReturn = DocIdSetIterator.NO_MORE_DOCS; // non matching
|
||||||
|
break;
|
||||||
|
}
|
||||||
iterators[j++] = dcit;
|
iterators[j++] = dcit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lastReturn = (iterators.length > 0 ? -1 : DocIdSetIterator.NO_MORE_DOCS);
|
if (lastReturn != DocIdSetIterator.NO_MORE_DOCS) {
|
||||||
|
lastReturn = (iterators.length > 0 ? -1 : DocIdSetIterator.NO_MORE_DOCS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -75,12 +75,21 @@ public class AndDocSet extends DocSet {
|
||||||
iterators = new DocIdSetIterator[sets.size()];
|
iterators = new DocIdSetIterator[sets.size()];
|
||||||
int j = 0;
|
int j = 0;
|
||||||
for (DocIdSet set : sets) {
|
for (DocIdSet set : sets) {
|
||||||
if (set != null) {
|
if (set == null) {
|
||||||
|
lastReturn = DocIdSetIterator.NO_MORE_DOCS; // non matching
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
DocIdSetIterator dcit = set.iterator();
|
DocIdSetIterator dcit = set.iterator();
|
||||||
|
if (dcit == null) {
|
||||||
|
lastReturn = DocIdSetIterator.NO_MORE_DOCS; // non matching
|
||||||
|
break;
|
||||||
|
}
|
||||||
iterators[j++] = dcit;
|
iterators[j++] = dcit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lastReturn = (iterators.length > 0 ? -1 : DocIdSetIterator.NO_MORE_DOCS);
|
if (lastReturn != DocIdSetIterator.NO_MORE_DOCS) {
|
||||||
|
lastReturn = (iterators.length > 0 ? -1 : DocIdSetIterator.NO_MORE_DOCS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -73,7 +73,10 @@ public class OrDocIdSet extends DocIdSet {
|
||||||
_heap = new Item[sets.size()];
|
_heap = new Item[sets.size()];
|
||||||
_size = 0;
|
_size = 0;
|
||||||
for (DocIdSet set : sets) {
|
for (DocIdSet set : sets) {
|
||||||
_heap[_size++] = new Item(set.iterator());
|
DocIdSetIterator iterator = set.iterator();
|
||||||
|
if (iterator != null) {
|
||||||
|
_heap[_size++] = new Item(iterator);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (_size == 0) _curDoc = DocIdSetIterator.NO_MORE_DOCS;
|
if (_size == 0) _curDoc = DocIdSetIterator.NO_MORE_DOCS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,10 @@ public class OrDocSet extends DocSet {
|
||||||
_heap = new Item[sets.size()];
|
_heap = new Item[sets.size()];
|
||||||
_size = 0;
|
_size = 0;
|
||||||
for (DocIdSet set : sets) {
|
for (DocIdSet set : sets) {
|
||||||
_heap[_size++] = new Item(set.iterator());
|
DocIdSetIterator iterator = set.iterator();
|
||||||
|
if (iterator != null) {
|
||||||
|
_heap[_size++] = new Item(iterator);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (_size == 0) _curDoc = DocIdSetIterator.NO_MORE_DOCS;
|
if (_size == 0) _curDoc = DocIdSetIterator.NO_MORE_DOCS;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue