@Override public int advance(int target) throws IOException { return in.advance(target); }
@Override public int advance(int target) throws IOException { assert target > doc; doc = postings.advance(target); if (doc != DocIdSetIterator.NO_MORE_DOCS) { freq = postings.freq(); assert freq >= 1; count = 0; } position = -1; return doc; }
@Override public int advance(int target) throws IOException { assert target > doc; while(true) { if (current != null) { final int doc; if (target < currentBase) { // target was in the previous slice but there was no matching doc after it doc = current.nextDoc(); } else { doc = current.advance(target-currentBase); } if (doc == NO_MORE_DOCS) { current = null; } else { return this.doc = doc + currentBase; } } else if (upto == numSubs-1) { return this.doc = NO_MORE_DOCS; } else { upto++; current = subs[upto].postingsEnum; currentBase = subs[upto].slice.start; } } }
@Override public int advance(int target) throws IOException { PostingsEnum top = docsQueue.top(); do { top.advance(target); top = docsQueue.updateTop(); } while (top.docID() < target); return top.docID(); }
/** * Create a {@link DisjunctionMatchesIterator} over a list of terms extracted from a {@link BytesRefIterator} * * Only terms that have at least one match in the given document will be included */ static MatchesIterator fromTermsEnum(LeafReaderContext context, int doc, Query query, String field, BytesRefIterator terms) throws IOException { Objects.requireNonNull(field); List<MatchesIterator> mis = new ArrayList<>(); Terms t = context.reader().terms(field); if (t == null) return null; TermsEnum te = t.iterator(); PostingsEnum reuse = null; for (BytesRef term = terms.next(); term != null; term = terms.next()) { if (te.seekExact(term)) { PostingsEnum pe = te.postings(reuse, PostingsEnum.OFFSETS); if (pe.advance(doc) == doc) { mis.add(new TermMatchesIterator(query, pe)); reuse = null; } else { reuse = pe; } } } return fromSubIterators(mis); }
final int skipDocID = (int) (((idx+1)*(long) maxDoc)/8); postings = termsEnum.postings(postings, PostingsEnum.ALL); final int docID = postings.advance(skipDocID); if (docID == DocIdSetIterator.NO_MORE_DOCS) { break; final int skipDocID = (int) (((idx+1)*(long) maxDoc)/8); postings = termsEnum.postings(postings, PostingsEnum.NONE); final int docID = postings.advance(skipDocID); if (docID == DocIdSetIterator.NO_MORE_DOCS) { break;
@Override public Matches matches(LeafReaderContext context, int doc) throws IOException { TermsEnum te = getTermsEnum(context); if (te == null) { return null; } if (context.reader().terms(term.field()).hasPositions() == false) { return super.matches(context, doc); } return MatchesUtils.forField(term.field(), () -> { PostingsEnum pe = te.postings(null, PostingsEnum.OFFSETS); if (pe.advance(doc) != doc) { return null; } return new TermMatchesIterator(getQuery(), pe); }); }
final int advanceDoc = postingsDocs.advance(j); if (advanceDoc != j) { throw new RuntimeException("vector term=" + term + " field=" + field + ": doc=" + j + " was not found in postings (got: " + advanceDoc + ")");
@Override public Explanation explain(LeafReaderContext context, int doc) throws IOException { String desc = "weight(" + getQuery() + " in " + doc + ") [" + function + "]"; Terms terms = context.reader().terms(fieldName); if (terms == null) { return Explanation.noMatch(desc + ". Field " + fieldName + " doesn't exist."); } TermsEnum termsEnum = terms.iterator(); if (termsEnum.seekExact(new BytesRef(featureName)) == false) { return Explanation.noMatch(desc + ". Feature " + featureName + " doesn't exist."); } PostingsEnum postings = termsEnum.postings(null, PostingsEnum.FREQS); if (postings.advance(doc) != doc) { return Explanation.noMatch(desc + ". Feature " + featureName + " isn't set."); } return function.explain(fieldName, featureName, boost, doc, postings.freq()); }
@Override public int advance(int target) throws IOException { return in.advance(target); }
@Override public int advance(int target) throws IOException { assert target > doc; doc = postings.advance(target); if (doc != DocIdSetIterator.NO_MORE_DOCS) { freq = postings.freq(); assert freq >= 1; count = 0; } position = -1; return doc; }
@Override public int advance(int target) throws IOException { assert target > doc; doc = postings.advance(target); if (doc != DocIdSetIterator.NO_MORE_DOCS) { freq = postings.freq(); assert freq >= 1; count = 0; } position = -1; return doc; }
@Override public int advance(int target) throws IOException { assert target > doc; doc = postings.advance(target); if (doc != DocIdSetIterator.NO_MORE_DOCS) { freq = postings.freq(); assert freq >= 1; count = 0; } position = -1; return doc; }
@Override public int advance(int target) throws IOException { int doc = pe.advance(target); reset(); return doc; }
@Override public int advance(int target) throws IOException { return doNext(in.advance(target)); }
@Override public int advance(int target) throws IOException { return doNext(in.advance(target)); }
@Override public boolean advanceExact(int doc) throws IOException { if (pe.docID() > doc) return false; return pe.docID() == doc || pe.advance(doc) == doc; } };
@Override public int advance(int target) throws IOException { PostingsEnum top = docsQueue.top(); do { top.advance(target); top = docsQueue.updateTop(); } while (top.docID() < target); return top.docID(); }
@Override public int advance(int target) throws IOException { PostingsEnum top = docsQueue.top(); do { top.advance(target); top = docsQueue.updateTop(); } while (top.docID() < target); return top.docID(); }
@Override public int advance(int target) throws IOException { PostingsEnum top = docsQueue.top(); do { top.advance(target); top = docsQueue.updateTop(); } while (top.docID() < target); return top.docID(); }