Better ExplainableSearchScript interface

This commit is contained in:
Nicolas Lalevée 2012-07-06 22:13:03 +02:00 committed by Shay Banon
parent 1dd30bd388
commit e91a0d85a7
2 changed files with 6 additions and 4 deletions

View File

@ -146,12 +146,12 @@ public class CustomScoreQueryParser implements QueryParser {
if (script instanceof ExplainableSearchScript) {
script.setNextDocId(docId);
script.setNextScore(subQueryExpl.getValue());
exp = ((ExplainableSearchScript) script).explain();
exp = ((ExplainableSearchScript) script).explain(subQueryExpl);
} else {
float score = score(docId, subQueryExpl.getValue());
exp = new Explanation(score, "script score function: product of:");
exp = new Explanation(score, "script score function: composed of:");
exp.addDetail(subQueryExpl);
}
exp.addDetail(subQueryExpl);
return exp;
}

View File

@ -27,7 +27,9 @@ public interface ExplainableSearchScript extends SearchScript {
/**
* Build the explanation of the current document being scored
*
* @param subQueryExpl the explanation of the subQuery
*/
Explanation explain();
Explanation explain(Explanation subQueryExpl);
}