Returns true iff there is such an entry.
Behaves as if written:
boolean skipTo(int target) { do { if (!next()) return false; } while (target > doc()); return true; }
165166167168169170171172173174175
// beyond this point all next and skipto will return false if (aprioriTermDocs.skipTo(100)) { assertTrue(testTermDocs.skipTo(100)); assertEquals(aprioriTermDocs.freq(), testTermDocs.freq()); assertEquals(aprioriTermDocs.doc(), testTermDocs.doc()); } else { assertFalse(testTermDocs.skipTo(100)); }
169170171172173174175176177178179
if (aprioriTermDocs.skipTo(100)) { assertTrue(testTermDocs.skipTo(100)); assertEquals(aprioriTermDocs.freq(), testTermDocs.freq()); assertEquals(aprioriTermDocs.doc(), testTermDocs.doc()); } else { assertFalse(testTermDocs.skipTo(100)); } if (aprioriTermDocs.next()) { assertTrue(testTermDocs.next());
182183184185186187188189190191192
} else { assertFalse(testTermDocs.next()); } if (aprioriTermDocs.skipTo(110)) { assertTrue(testTermDocs.skipTo(110)); assertEquals(aprioriTermDocs.freq(), testTermDocs.freq()); assertEquals(aprioriTermDocs.doc(), testTermDocs.doc()); } else { assertFalse(testTermDocs.skipTo(110)); }
186187188189190191192193194195196
if (aprioriTermDocs.skipTo(110)) { assertTrue(testTermDocs.skipTo(110)); assertEquals(aprioriTermDocs.freq(), testTermDocs.freq()); assertEquals(aprioriTermDocs.doc(), testTermDocs.doc()); } else { assertFalse(testTermDocs.skipTo(110)); } if (aprioriTermDocs.skipTo(10)) { assertTrue(testTermDocs.skipTo(10)); assertEquals(aprioriTermDocs.freq(), testTermDocs.freq());
190191192193194195196197198199200
} else { assertFalse(testTermDocs.skipTo(110)); } if (aprioriTermDocs.skipTo(10)) { assertTrue(testTermDocs.skipTo(10)); assertEquals(aprioriTermDocs.freq(), testTermDocs.freq()); assertEquals(aprioriTermDocs.doc(), testTermDocs.doc()); } else { assertFalse(testTermDocs.skipTo(10)); }
194195196197198199200201202203204
if (aprioriTermDocs.skipTo(10)) { assertTrue(testTermDocs.skipTo(10)); assertEquals(aprioriTermDocs.freq(), testTermDocs.freq()); assertEquals(aprioriTermDocs.doc(), testTermDocs.doc()); } else { assertFalse(testTermDocs.skipTo(10)); } if (aprioriTermDocs.skipTo(210)) { assertTrue(testTermDocs.skipTo(210));
199200201202203204205206207208209
assertFalse(testTermDocs.skipTo(10)); } if (aprioriTermDocs.skipTo(210)) { assertTrue(testTermDocs.skipTo(210)); assertEquals(aprioriTermDocs.freq(), testTermDocs.freq()); assertEquals(aprioriTermDocs.doc(), testTermDocs.doc()); } else { assertFalse(testTermDocs.skipTo(210)); }
203204205206207208209210211212213
if (aprioriTermDocs.skipTo(210)) { assertTrue(testTermDocs.skipTo(210)); assertEquals(aprioriTermDocs.freq(), testTermDocs.freq()); assertEquals(aprioriTermDocs.doc(), testTermDocs.doc()); } else { assertFalse(testTermDocs.skipTo(210)); } aprioriTermDocs.close(); testTermDocs.close();
465466467468469470471472473474475
TermDocs aprioriTermDocsSeeker = aprioriReader.termDocs(aprioriTermEnum.term()); TermDocs testTermDocsSeeker = testReader.termDocs(testTermEnum.term()); while (aprioriTermDocsSeeker.next()) { assertTrue(testTermDocsSeeker.skipTo(aprioriTermDocsSeeker.doc())); assertEquals(aprioriTermDocsSeeker.doc(), testTermDocsSeeker.doc()); } aprioriTermDocsSeeker.close(); testTermDocsSeeker.close();
102103104105106107108109110111112
return doc; } @Override public int advance(int target) throws IOException { if (!termDocs.skipTo(target)) return doc = NO_MORE_DOCS; while (!matchDoc(doc = termDocs.doc())) { if (!termDocs.next()) return doc = NO_MORE_DOCS; }