/** * Skip to the specified document (or the first document after it containing hits) * * @param doc the doc number to skip to (or past) * @return true if we're still pointing to a valid hit, false if we're done * @throws IOException */ @Override public boolean skipTo(int doc) throws IOException { // Skip both to doc stillValidContainers = producer.skipTo(doc); // Find first matching container from here return synchronize(); }
private boolean synchronize() throws IOException { while (more && spans.doc() != docIdSetIter.docID()) { if (spans.doc() < docIdSetIter.docID()) { more = spans.skipTo(docIdSetIter.docID()); } else if (docIdSetIter.advance(spans.doc()) == DocIdSetIterator.NO_MORE_DOCS) { more = false; } } return more; }
@Override public boolean skipTo(int target) throws IOException { if (!more) return false; more = spans.skipTo(target); return synchronize(); }