NPE when using "not" filter, closes #953.
This commit is contained in:
parent
811f14465a
commit
9a536b2c2b
|
@ -53,13 +53,13 @@ public class AllDocSet extends DocSet {
|
||||||
return new AllDocIdSetIterator(maxDoc);
|
return new AllDocIdSetIterator(maxDoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final class AllDocIdSetIterator extends DocIdSetIterator {
|
public static final class AllDocIdSetIterator extends DocIdSetIterator {
|
||||||
|
|
||||||
private final int maxDoc;
|
private final int maxDoc;
|
||||||
|
|
||||||
private int doc = -1;
|
private int doc = -1;
|
||||||
|
|
||||||
private AllDocIdSetIterator(int maxDoc) {
|
public AllDocIdSetIterator(int maxDoc) {
|
||||||
this.maxDoc = maxDoc;
|
this.maxDoc = maxDoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,21 +46,22 @@ public class NotDocIdSet extends DocIdSet {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public DocIdSetIterator iterator() throws IOException {
|
@Override public DocIdSetIterator iterator() throws IOException {
|
||||||
return new NotDocIdSetIterator();
|
DocIdSetIterator it = set.iterator();
|
||||||
|
if (it == null) {
|
||||||
|
return new AllDocSet.AllDocIdSetIterator(max);
|
||||||
|
}
|
||||||
|
return new NotDocIdSetIterator(max, it);
|
||||||
}
|
}
|
||||||
|
|
||||||
class NotDocIdSetIterator extends DocIdSetIterator {
|
public static class NotDocIdSetIterator extends DocIdSetIterator {
|
||||||
|
private final int max;
|
||||||
|
private DocIdSetIterator it1;
|
||||||
int lastReturn = -1;
|
int lastReturn = -1;
|
||||||
private DocIdSetIterator it1 = null;
|
|
||||||
private int innerDocid = -1;
|
private int innerDocid = -1;
|
||||||
|
|
||||||
NotDocIdSetIterator() throws IOException {
|
NotDocIdSetIterator(int max, DocIdSetIterator it) throws IOException {
|
||||||
initialize();
|
this.max = max;
|
||||||
}
|
this.it1 = it;
|
||||||
|
|
||||||
private void initialize() throws IOException {
|
|
||||||
it1 = set.iterator();
|
|
||||||
|
|
||||||
if ((innerDocid = it1.nextDoc()) == DocIdSetIterator.NO_MORE_DOCS) it1 = null;
|
if ((innerDocid = it1.nextDoc()) == DocIdSetIterator.NO_MORE_DOCS) it1 = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue