fix naming, also make explainable search script extend search script

This commit is contained in:
Shay Banon 2012-07-06 01:00:44 +02:00
parent a77c824476
commit dcf9194820
3 changed files with 6 additions and 8 deletions

View File

@ -27,7 +27,7 @@ import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.lucene.search.function.FunctionScoreQuery;
import org.elasticsearch.common.lucene.search.function.ScoreFunction;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.script.ExplanableSearchScript;
import org.elasticsearch.script.ExplainableSearchScript;
import org.elasticsearch.script.SearchScript;
import java.io.IOException;
@ -143,10 +143,10 @@ public class CustomScoreQueryParser implements QueryParser {
@Override
public Explanation explainScore(int docId, Explanation subQueryExpl) {
Explanation exp;
if (script instanceof ExplanableSearchScript) {
if (script instanceof ExplainableSearchScript) {
script.setNextDocId(docId);
script.setNextScore(subQueryExpl.getValue());
exp = ((ExplanableSearchScript) script).explain();
exp = ((ExplainableSearchScript) script).explain();
} else {
float score = score(docId, subQueryExpl.getValue());
exp = new Explanation(score, "script score function: product of:");

View File

@ -23,12 +23,10 @@ import org.apache.lucene.search.Explanation;
/**
* To be implemented by {@link SearchScript} which can provided an {@link Explanation} of the score
*/
public interface ExplanableSearchScript {
public interface ExplainableSearchScript extends SearchScript {
/**
* Build the explanation of the current document being scored
*
* @return
*/
Explanation explain();

View File

@ -26,8 +26,8 @@ import java.util.Map;
/**
* A search script.
*
* @see ExplanableSearchScript for script which can explain a score
*
* @see ExplainableSearchScript for script which can explain a score
*/
public interface SearchScript extends ExecutableScript {