@Override public BulkScorer bulkScorer(LeafReaderContext context) throws IOException { // Bulk scorers need to consume the entire set of docs, so using an // index structure should perform better return indexWeight.bulkScorer(context); }
@Override public BulkScorer bulkScorer(LeafReaderContext context) throws IOException { final BulkScorer bulkScorer = booleanScorer(context); if (bulkScorer != null) { // bulk scoring is applicable, use it return bulkScorer; } else { // use a Scorer-based impl (BS2) return super.bulkScorer(context); } }
@Override public BulkScorer bulkScorer(LeafReaderContext context) throws IOException { final BulkScorer innerScorer = innerWeight.bulkScorer(context); if (innerScorer == null) { return null; } return new ConstantBulkScorer(innerScorer, this, score()); }
BulkScorer optionalBulkScorer(LeafReaderContext context) throws IOException { List<BulkScorer> optional = new ArrayList<BulkScorer>(); Iterator<BooleanClause> cIter = query.iterator(); for (Weight w : weights) { BooleanClause c = cIter.next(); if (c.getOccur() != Occur.SHOULD) { continue; } BulkScorer subScorer = w.bulkScorer(context); if (subScorer != null) { optional.add(subScorer); } } if (optional.size() == 0) { return null; } if (query.getMinimumNumberShouldMatch() > optional.size()) { return null; } if (optional.size() == 1) { return optional.get(0); } return new BooleanScorer(this, optional, Math.max(1, query.getMinimumNumberShouldMatch()), needsScores); }
private DocIdSet cache(LeafReaderContext context) throws IOException { final BulkScorer scorer = in.bulkScorer(context); if (scorer == null) { return DocIdSet.EMPTY; } else { return cacheImpl(scorer, context.reader().maxDoc()); } }
@Override public BulkScorer bulkScorer(LeafReaderContext context) throws IOException { final WeightOrDocIdSet weightOrBitSet = rewrite(context); if (weightOrBitSet.weight != null) { return weightOrBitSet.weight.bulkScorer(context); } else { final Scorer scorer = scorer(weightOrBitSet.set); if (scorer == null) { return null; } return new DefaultBulkScorer(scorer); } }
@Override public BulkScorer bulkScorer(LeafReaderContext context) throws IOException { final WeightOrDocIdSet weightOrBitSet = rewrite(context); if (weightOrBitSet == null) { return null; } else if (weightOrBitSet.weight != null) { return weightOrBitSet.weight.bulkScorer(context); } else { final Scorer scorer = scorer(weightOrBitSet.set); if (scorer == null) { return null; } return new DefaultBulkScorer(scorer); } }
private BulkScorer requiredBulkScorer(LeafReaderContext context) throws IOException { BulkScorer scorer = null; Iterator<BooleanClause> cIter = query.iterator(); for (Weight w : weights) { BooleanClause c = cIter.next(); if (c.isRequired() == false) { continue; } if (scorer != null) { // we don't have a BulkScorer for conjunctions return null; } scorer = w.bulkScorer(context); if (scorer == null) { // no matches return null; } if (c.isScoring() == false && needsScores) { scorer = disableScoring(scorer); } } return scorer; }
return in.bulkScorer(context); return in.bulkScorer(context); if (cacheHelper == null) { return in.bulkScorer(context); return in.bulkScorer(context); putIfAbsent(in.getQuery(), context, docIdSet, cacheHelper); } else { return in.bulkScorer(context);
BulkScorer scorer = weight.bulkScorer(ctx); if (scorer != null) { try {
@Override public BulkScorer bulkScorer(LeafReaderContext context) throws IOException { // We use the default bulk scorer instead of the specialized one. The reason // is that Lucene's BulkScorers do everything at once: finding matches, // scoring them and calling the collector, so they make it impossible to // see where time is spent, which is the purpose of query profiling. // The default bulk scorer will pull a scorer and iterate over matches, // this might be a significantly different execution path for some queries // like disjunctions, but in general this is what is done anyway return super.bulkScorer(context); }
@Override public BulkScorer bulkScorer(LeafReaderContext context) throws IOException { BulkScorer in = weight.bulkScorer(context); if (in != null) { return new CancellableBulkScorer(in, checkCancelled); } else { return null; } } };
@Override public BulkScorer bulkScorer(LeafReaderContext context) throws IOException { shardKeyMap.add(context.reader()); return in.bulkScorer(context); }
@Override public BulkScorer bulkScorer(LeafReaderContext context) throws IOException { return weight.bulkScorer(context); } };
private static void suggest(IndexSearcher searcher, CompletionQuery query, TopSuggestDocsCollector collector) throws IOException { query = (CompletionQuery) query.rewrite(searcher.getIndexReader()); Weight weight = query.createWeight(searcher, collector.needsScores(), 1f); for (LeafReaderContext context : searcher.getIndexReader().leaves()) { BulkScorer scorer = weight.bulkScorer(context); if (scorer != null) { try { scorer.score(collector.getLeafCollector(context), context.reader().getLiveDocs()); } catch (CollectionTerminatedException e) { // collection was terminated prematurely // continue with the following leaf } } } } }
@Override public BulkScorer bulkScorer(LeafReaderContext context) throws IOException { return delegate.bulkScorer( context ); }
@Override public BulkScorer bulkScorer(LeafReaderContext context) throws IOException { final BulkScorer bulkScorer = booleanScorer(context); if (bulkScorer != null) { // bulk scoring is applicable, use it return bulkScorer; } else { // use a Scorer-based impl (BS2) return super.bulkScorer(context); } }
@Override public BulkScorer bulkScorer(LeafReaderContext context) throws IOException { final BulkScorer innerScorer = innerWeight.bulkScorer(context); if (innerScorer == null) { return null; } return new ConstantBulkScorer(innerScorer, this, score()); }
@Override public BulkScorer bulkScorer(LeafReaderContext context) throws IOException { shardKeyMap.add(context.reader()); return in.bulkScorer(context); }
private DocIdSet cache(LeafReaderContext context) throws IOException { final BulkScorer scorer = in.bulkScorer(context); if (scorer == null) { return DocIdSet.EMPTY; } else { return cacheImpl(scorer, context.reader().maxDoc()); } }