protected ConstantScoreWeight(Query query) { super( query ); normalize( 1f, 1f ); }
@Override public Explanation explain(LeafReaderContext context, int doc) throws IOException { final Scorer s = scorer( context ); final boolean exists; if ( s == null ) { exists = false; } else { final TwoPhaseIterator twoPhase = s.twoPhaseIterator(); if ( twoPhase == null ) { exists = s.iterator().advance( doc ) == doc; } else { exists = twoPhase.approximation().advance( doc ) == doc && twoPhase.matches(); } } if ( exists ) { return Explanation.match( queryWeight, getQuery().toString() + ", product of:", Explanation.match( boost, "boost" ), Explanation.match( queryNorm, "queryNorm" ) ); } else { return Explanation.noMatch( getQuery().toString() + " doesn't match id " + doc ); } } }
@Override public Explanation explain(LeafReaderContext context, int doc) throws IOException { final Scorer s = scorer( context ); final boolean exists; if ( s == null ) { exists = false; } else { final TwoPhaseIterator twoPhase = s.twoPhaseIterator(); if ( twoPhase == null ) { exists = s.iterator().advance( doc ) == doc; } else { exists = twoPhase.approximation().advance( doc ) == doc && twoPhase.matches(); } } if ( exists ) { return Explanation.match( queryWeight, getQuery().toString() + ", product of:", Explanation.match( boost, "boost" ), Explanation.match( queryNorm, "queryNorm" ) ); } else { return Explanation.noMatch( getQuery().toString() + " doesn't match id " + doc ); } } }
protected ConstantScoreWeight(Query query) { super( query ); normalize( 1f, 1f ); }