From dcf91948201e218d6c396427c38122b0d976b064 Mon Sep 17 00:00:00 2001 From: Shay Banon Date: Fri, 6 Jul 2012 01:00:44 +0200 Subject: [PATCH] fix naming, also make explainable search script extend search script --- .../elasticsearch/index/query/CustomScoreQueryParser.java | 6 +++--- ...anableSearchScript.java => ExplainableSearchScript.java} | 4 +--- src/main/java/org/elasticsearch/script/SearchScript.java | 4 ++-- 3 files changed, 6 insertions(+), 8 deletions(-) rename src/main/java/org/elasticsearch/script/{ExplanableSearchScript.java => ExplainableSearchScript.java} (94%) diff --git a/src/main/java/org/elasticsearch/index/query/CustomScoreQueryParser.java b/src/main/java/org/elasticsearch/index/query/CustomScoreQueryParser.java index 73f55ce7b6d..c6195dbb764 100644 --- a/src/main/java/org/elasticsearch/index/query/CustomScoreQueryParser.java +++ b/src/main/java/org/elasticsearch/index/query/CustomScoreQueryParser.java @@ -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:"); diff --git a/src/main/java/org/elasticsearch/script/ExplanableSearchScript.java b/src/main/java/org/elasticsearch/script/ExplainableSearchScript.java similarity index 94% rename from src/main/java/org/elasticsearch/script/ExplanableSearchScript.java rename to src/main/java/org/elasticsearch/script/ExplainableSearchScript.java index 638aa961fa4..60cf0b46f5a 100644 --- a/src/main/java/org/elasticsearch/script/ExplanableSearchScript.java +++ b/src/main/java/org/elasticsearch/script/ExplainableSearchScript.java @@ -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(); diff --git a/src/main/java/org/elasticsearch/script/SearchScript.java b/src/main/java/org/elasticsearch/script/SearchScript.java index d061d3a4eae..2ea16f07fcc 100644 --- a/src/main/java/org/elasticsearch/script/SearchScript.java +++ b/src/main/java/org/elasticsearch/script/SearchScript.java @@ -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 {