Code with Finding: |
class CustomScoreQuery.CustomScorer {
/*(non-Javadoc) @see org.apache.lucene.search.Scorer#explain(int) */
public Explanation explain(int doc) throws IOException {
Explanation subQueryExpl = weight.subQueryWeight.explain(reader,doc);
if (!subQueryExpl.isMatch()) {
return subQueryExpl;
}
// match
Explanation[] valSrcExpls = new Explanation[valSrcScorers.length];
for(int i = 0; i < valSrcScorers.length; i++) {
valSrcExpls[i] = valSrcScorers[i].explain(doc);
}
Explanation customExp = customExplain(doc,subQueryExpl,valSrcExpls);
float sc = qWeight * customExp.getValue();
Explanation res = new ComplexExplanation(
true, sc, CustomScoreQuery.this.toString() + ", product of:");
res.addDetail(customExp);
res.addDetail(new Explanation(qWeight, "queryBoost")); // actually using the q boost as q weight (== weight value)
return res;
}
}
|