@Override public Spans getSpans(final LeafReaderContext context, Postings requiredPostings) throws IOException { Spans matchSpans = matchWeight.getSpans(context, requiredPostings); return (matchSpans == null) ? null : new FilterSpans(matchSpans) { @Override protected AcceptStatus accept(Spans candidate) throws IOException { return acceptPosition(candidate); } }; }
ArrayList<Spans> prepareConjunction(final LeafReaderContext context, Postings postings) throws IOException { Spans bigSpans = bigWeight.getSpans(context, postings); if (bigSpans == null) { return null; } Spans littleSpans = littleWeight.getSpans(context, postings); if (littleSpans == null) { return null; } ArrayList<Spans> bigAndLittle = new ArrayList<>(); bigAndLittle.add(bigSpans); bigAndLittle.add(littleSpans); return bigAndLittle; }
@Override public SpanScorer scorer(LeafReaderContext context) throws IOException { final Spans spans = getSpans(context, Postings.POSITIONS); if (spans == null) { return null; } final Similarity.SimScorer docScorer = getSimScorer(context); return new SpanScorer(this, spans, docScorer); }
@Override public Spans getSpans(final LeafReaderContext context, Postings requiredPostings) throws IOException { Spans includeSpans = includeWeight.getSpans(context, requiredPostings); if (includeSpans == null) { return null; Spans excludeSpans = excludeWeight.getSpans(context, requiredPostings); if (excludeSpans == null) { return includeSpans;
@Override public Spans getSpans(final LeafReaderContext context, Postings requiredPostings) throws IOException { Terms terms = context.reader().terms(field); if (terms == null) { return null; // field does not exist } ArrayList<Spans> subSpans = new ArrayList<>(clauses.size()); for (SpanWeight w : subWeights) { Spans subSpan = w.getSpans(context, requiredPostings); if (subSpan != null) { subSpans.add(subSpan); } else { return null; // all required } } // all NearSpans require at least two subSpans return (!inOrder) ? new NearSpansUnordered(slop, subSpans) : new NearSpansOrdered(slop, subSpans); }
Spans spans = w.getSpans(context, requiredPostings); if (spans != null) { subSpans.add(spans);
@Override public Matches matches(LeafReaderContext context, int doc) throws IOException { return MatchesUtils.forField(field, () -> { Spans spans = getSpans(context, Postings.OFFSETS); if (spans == null || spans.advance(doc) != doc) { return null;
@Override public Spans getSpans(final LeafReaderContext context, Postings requiredPostings) throws IOException { Spans matchSpans = matchWeight.getSpans(context, requiredPostings); return (matchSpans == null) ? null : new FilterSpans(matchSpans) { @Override protected AcceptStatus accept(Spans candidate) throws IOException { return acceptPosition(candidate); } }; }
@Override public Spans getSpans(LeafReaderContext ctx, Postings requiredPostings) throws IOException { return in.getSpans(ctx, Postings.OFFSETS); }
@Override public Spans getSpans(final LeafReaderContext context, Postings requiredPostings) throws IOException { Spans matchSpans = matchWeight.getSpans(context, requiredPostings); return (matchSpans == null) ? null : new FilterSpans(matchSpans) { @Override protected AcceptStatus accept(Spans candidate) throws IOException { return acceptPosition(candidate); } }; }
@Override public Spans getSpans(final LeafReaderContext context, Postings requiredPostings) throws IOException { Spans matchSpans = matchWeight.getSpans(context, requiredPostings); return (matchSpans == null) ? null : new FilterSpans(matchSpans) { @Override protected AcceptStatus accept(Spans candidate) throws IOException { return acceptPosition(candidate); } }; }
@Override public Spans getSpans(LeafReaderContext ctx, Postings requiredPostings) throws IOException { return weight.getSpans(ctx, requiredPostings); }
@Override public Spans getSpans(LeafReaderContext ctx, Postings requiredPostings) throws IOException { return innerWeight.getSpans(ctx, requiredPostings.atLeast(Postings.PAYLOADS)); }
@Override public Spans getSpans(LeafReaderContext ctx, Postings requiredPostings) throws IOException { return innerWeight.getSpans(ctx, requiredPostings.atLeast(Postings.PAYLOADS)); }
@Override public SpanScorer scorer(LeafReaderContext context) throws IOException { final Spans spans = getSpans(context, Postings.POSITIONS); if (spans == null) { return null; } final Similarity.SimScorer docScorer = getSimScorer(context); return new SpanScorer(this, spans, docScorer); }
@Override public SpanScorer scorer(LeafReaderContext context) throws IOException { final Spans spans = getSpans(context, Postings.POSITIONS); if (spans == null) { return null; } final Similarity.SimScorer docScorer = getSimScorer(context); return new SpanScorer(this, spans, docScorer); }
@Override public Spans getSpans(final LeafReaderContext context, Postings requiredPostings) throws IOException { final PayloadChecker collector = new PayloadChecker(); Spans matchSpans = matchWeight.getSpans(context, requiredPostings.atLeast(Postings.PAYLOADS)); return (matchSpans == null) ? null : new FilterSpans(matchSpans) { @Override protected AcceptStatus accept(Spans candidate) throws IOException { collector.reset(); candidate.collect(collector); return collector.match(); } }; }
@Override public SpanScorer scorer(LeafReaderContext context) throws IOException { final Spans spans = getSpans(context, Postings.POSITIONS); if (spans == null) { return null; } final Similarity.SimScorer docScorer = getSimScorer(context); return new SpanScorer(this, spans, docScorer); }
@Override public Spans getSpans(final LeafReaderContext context, Postings requiredPostings) throws IOException { final PayloadChecker collector = new PayloadChecker(); Spans matchSpans = matchWeight.getSpans(context, requiredPostings.atLeast(Postings.PAYLOADS)); return (matchSpans == null) ? null : new FilterSpans(matchSpans) { @Override protected AcceptStatus accept(Spans candidate) throws IOException { collector.reset(); candidate.collect(collector); return collector.match(); } }; }
@Override public Spans getSpans(final LeafReaderContext context, Postings requiredPostings) throws IOException { final PayloadChecker collector = new PayloadChecker(); Spans matchSpans = matchWeight.getSpans(context, requiredPostings.atLeast(Postings.PAYLOADS)); return (matchSpans == null) ? null : new FilterSpans(matchSpans) { @Override protected AcceptStatus accept(Spans candidate) throws IOException { collector.reset(); candidate.collect(collector); return collector.match(); } }; }