Refine search
private boolean ensureValidDisi() { while ( currentIdIterator == null && docs.hasNext() ) { MatchingDocs matchingDocs = docs.next(); try { currentIdIterator = matchingDocs.docIdSet.iterator(); if ( keepScores ) { currentScorer = new ReplayingScorer( matchingDocs.scores ); } else { currentScorer = new ConstantScoreScorer( null, Float.NaN, currentIdIterator ); } currentReader = matchingDocs.context.reader(); } catch ( IOException e ) { throw new RuntimeException( e ); } } return currentIdIterator != null; } }
@Override public Scorer get(long LeadCost) throws IOException { return new ConstantScoreScorer(CachingWrapperWeight.this, 0f, disi); }
private static Scorer constantScorer( float score ) { return new ConstantScoreScorer( null, score, (DocIdSetIterator) null ); } }
@Override public Scorer scorer(LeafReaderContext context) throws IOException { DocIdSetIterator iterator = getDocValuesDocIdSetIterator(field, context.reader()); if (iterator == null) { return null; } return new ConstantScoreScorer(this, score(), iterator); }
private Scorer scorer(DocIdSet set) throws IOException { if (set == null) { return null; } final DocIdSetIterator disi = set.iterator(); if (disi == null) { return null; } return new ConstantScoreScorer(this, score(), disi); }
@Override public Scorer scorer(LeafReaderContext context) throws IOException { final SortedNumericDocValues values = context.reader().getSortedNumericDocValues(field); if (values == null) { return null; } final TwoPhaseIterator iterator = new TwoPhaseIterator(values) { @Override public boolean matches() throws IOException { for (int i = 0, count = values.docValueCount(); i < count; ++i) { final long value = values.nextValue(); final int lat = (int) (value >>> 32); final int lon = (int) (value & 0xFFFFFFFF); if (distancePredicate.test(lat, lon)) { return true; } } return false; } @Override public float matchCost() { return 100f; // TODO: what should it be? } }; return new ConstantScoreScorer(this, boost, iterator); }
private Scorer scorer(DocIdSet set) throws IOException { if (set == null) { return null; } final DocIdSetIterator disi = set.iterator(); if (disi == null) { return null; } return new ConstantScoreScorer(this, score(), disi); }
@Override public Scorer scorer(LeafReaderContext context) throws IOException { final SortedNumericDocValues values = context.reader().getSortedNumericDocValues(field); if (values == null) { return null; return new ConstantScoreScorer(this, boost, iterator);
private void replayTo( Collector collector ) throws IOException { for ( MatchingDocs docs : getMatchingDocs() ) { LeafCollector leafCollector = collector.getLeafCollector( docs.context ); Scorer scorer; DocIdSetIterator idIterator = docs.docIdSet.iterator(); if ( isKeepScores() ) { scorer = new ReplayingScorer( docs.scores ); } else { scorer = new ConstantScoreScorer( null, Float.NaN, idIterator ); } leafCollector.setScorer( scorer ); int doc; while ( (doc = idIterator.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS ) { leafCollector.collect( doc ); } } }
@Override public Scorer scorer(LeafReaderContext context) throws IOException { return new ConstantScoreScorer(this, score(), DocIdSetIterator.all(context.reader().maxDoc())); }
@Override public Scorer get(long LeadCost) throws IOException { return new ConstantScoreScorer(CachingWrapperWeight.this, 0f, disi); }
@Override public Scorer scorer(LeafReaderContext context) throws IOException { FieldInfos fieldInfos = context.reader().getFieldInfos(); FieldInfo fieldInfo = fieldInfos.fieldInfo(field); if (fieldInfo == null || fieldInfo.hasNorms() == false) { return null; } LeafReader reader = context.reader(); DocIdSetIterator iterator = reader.getNormValues(field); return new ConstantScoreScorer(this, score(), iterator); }
/** returns a Scorer for all other (non INTERSECT) queries */ protected Scorer getScorer(XLatLonShapeQuery query, Weight weight, FixedBitSet intersect, FixedBitSet disjoint, final float boost) throws IOException { values.intersect(visitor); DocIdSetIterator iterator; if (query.queryRelation == QueryRelation.DISJOINT) { disjoint.andNot(intersect); iterator = new BitSetIterator(disjoint, cost()); } else if (query.queryRelation == QueryRelation.WITHIN) { intersect.andNot(disjoint); iterator = new BitSetIterator(intersect, cost()); } else { iterator = new BitSetIterator(intersect, cost()); } return new ConstantScoreScorer(weight, boost, iterator); }
@Override public Scorer scorer(LeafReaderContext context) throws IOException { SortedNumericDocValues values = getValues(context.reader(), field); if (values == null) { return null; return new ConstantScoreScorer(this, score(), iterator);
/** returns a Scorer for INTERSECT queries that uses a sparse bitset */ protected Scorer getIntersectsScorer(XLatLonShapeQuery query, LeafReader reader, Weight weight, DocIdSetBuilder docIdSetBuilder, final float boost) throws IOException { if (values.getDocCount() == reader.maxDoc() && values.getDocCount() == values.size() && cost() > reader.maxDoc() / 2) { // If all docs have exactly one value and the cost is greater // than half the leaf size then maybe we can make things faster // by computing the set of documents that do NOT match the query final FixedBitSet result = new FixedBitSet(reader.maxDoc()); result.set(0, reader.maxDoc()); int[] cost = new int[]{reader.maxDoc()}; values.intersect(getInverseIntersectVisitor(query, result, cost)); final DocIdSetIterator iterator = new BitSetIterator(result, cost[0]); return new ConstantScoreScorer(weight, boost, iterator); } values.intersect(visitor); DocIdSetIterator iterator = docIdSetBuilder.build().iterator(); return new ConstantScoreScorer(weight, boost, iterator); }
@Override public Scorer scorer(LeafReaderContext context) throws IOException { SortedSetDocValues values = getValues(context.reader(), field); if (values == null) { return null; return new ConstantScoreScorer(this, score(), iterator);
private void replayTo( Collector collector ) throws IOException { for ( MatchingDocs docs : getMatchingDocs() ) { LeafCollector leafCollector = collector.getLeafCollector( docs.context ); Scorer scorer; DocIdSetIterator idIterator = docs.docIdSet.iterator(); if ( isKeepScores() ) { scorer = new ReplayingScorer( docs.scores ); } else { scorer = new ConstantScoreScorer( null, Float.NaN, idIterator ); } leafCollector.setScorer( scorer ); int doc; while ( (doc = idIterator.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS ) { leafCollector.collect( doc ); } } }
final IndexReader.CacheHelper cacheHelper = context.reader().getCoreCacheHelper(); if (cacheHelper == null) { return new DefaultBulkScorer(new ConstantScoreScorer(this, 0f, disi));
@Override public Scorer scorer(LeafReaderContext leafReaderContext) throws IOException { return new ConstantScoreScorer(this, score(), docIdSetIterator); }
@Override public Scorer scorer(LeafReaderContext context) throws IOException { final SortedSetDocValues fcsi = DocValues.getSortedSet(context.reader(), query.field); TermsEnum termsEnum = getTermsEnum(fcsi); assert termsEnum != null; return new ConstantScoreScorer(this, score(), new TwoPhaseIterator(fcsi) {