@@ -34,11 +34,74 @@ public NotDocSet(DocSet set, int max) {
34
34
}
35
35
36
36
@ Override public boolean isCacheable () {
37
- // if it is cached, create a new doc set for it so it will be fast for advance in iterator
38
- return false ;
37
+ return set .isCacheable ();
39
38
}
40
39
41
40
@ Override public boolean get (int doc ) throws IOException {
42
41
return !set .get (doc );
43
42
}
43
+
44
+ // This seems like overhead compared to testing with get and iterating over docs
45
+ // @Override public DocIdSetIterator iterator() throws IOException {
46
+ // return new NotDocIdSetIterator();
47
+ // }
48
+ //
49
+ // class NotDocIdSetIterator extends DocIdSetIterator {
50
+ // int lastReturn = -1;
51
+ // private DocIdSetIterator it1 = null;
52
+ // private int innerDocid = -1;
53
+ //
54
+ // NotDocIdSetIterator() throws IOException {
55
+ // initialize();
56
+ // }
57
+ //
58
+ // private void initialize() throws IOException {
59
+ // it1 = set.iterator();
60
+ //
61
+ // if ((innerDocid = it1.nextDoc()) == DocIdSetIterator.NO_MORE_DOCS) it1 = null;
62
+ // }
63
+ //
64
+ // @Override
65
+ // public int docID() {
66
+ // return lastReturn;
67
+ // }
68
+ //
69
+ // @Override
70
+ // public int nextDoc() throws IOException {
71
+ // return advance(0);
72
+ // }
73
+ //
74
+ // @Override
75
+ // public int advance(int target) throws IOException {
76
+ //
77
+ // if (lastReturn == DocIdSetIterator.NO_MORE_DOCS) {
78
+ // return DocIdSetIterator.NO_MORE_DOCS;
79
+ // }
80
+ //
81
+ // if (target <= lastReturn) target = lastReturn + 1;
82
+ //
83
+ // if (it1 != null && innerDocid < target) {
84
+ // if ((innerDocid = it1.advance(target)) == DocIdSetIterator.NO_MORE_DOCS) {
85
+ // it1 = null;
86
+ // }
87
+ // }
88
+ //
89
+ // while (it1 != null && innerDocid == target) {
90
+ // target++;
91
+ // if (target >= max) {
92
+ // return (lastReturn = DocIdSetIterator.NO_MORE_DOCS);
93
+ // }
94
+ // if ((innerDocid = it1.advance(target)) == DocIdSetIterator.NO_MORE_DOCS) {
95
+ // it1 = null;
96
+ // }
97
+ // }
98
+ //
99
+ // // ADDED THIS, bug in code
100
+ // if (target >= max) {
101
+ // return (lastReturn = DocIdSetIterator.NO_MORE_DOCS);
102
+ // }
103
+ //
104
+ // return (lastReturn = target);
105
+ // }
106
+ // }
44
107
}
0 commit comments