Better ExplainableSearchScript interface
This commit is contained in:
parent
1dd30bd388
commit
e91a0d85a7
|
@ -146,12 +146,12 @@ public class CustomScoreQueryParser implements QueryParser {
|
||||||
if (script instanceof ExplainableSearchScript) {
|
if (script instanceof ExplainableSearchScript) {
|
||||||
script.setNextDocId(docId);
|
script.setNextDocId(docId);
|
||||||
script.setNextScore(subQueryExpl.getValue());
|
script.setNextScore(subQueryExpl.getValue());
|
||||||
exp = ((ExplainableSearchScript) script).explain();
|
exp = ((ExplainableSearchScript) script).explain(subQueryExpl);
|
||||||
} else {
|
} else {
|
||||||
float score = score(docId, subQueryExpl.getValue());
|
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;
|
return exp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,9 @@ public interface ExplainableSearchScript extends SearchScript {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build the explanation of the current document being scored
|
* Build the explanation of the current document being scored
|
||||||
|
*
|
||||||
|
* @param subQueryExpl the explanation of the subQuery
|
||||||
*/
|
*/
|
||||||
Explanation explain();
|
Explanation explain(Explanation subQueryExpl);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue