From 80d79c9c11ab00c0a56756399ac70715e53bcc47 Mon Sep 17 00:00:00 2001 From: Isabel Drost-Fromm Date: Thu, 21 Jan 2016 16:11:34 +0100 Subject: [PATCH] Remove deprecated parameters This is in preparation of refactoring. Relates to #15178 --- .../search/sort/ScriptSortBuilder.java | 81 +------------------ .../search/sort/SortBuilders.java | 14 ---- 2 files changed, 2 insertions(+), 93 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/search/sort/ScriptSortBuilder.java b/core/src/main/java/org/elasticsearch/search/sort/ScriptSortBuilder.java index 36b651a2220..e9a9c8df57c 100644 --- a/core/src/main/java/org/elasticsearch/search/sort/ScriptSortBuilder.java +++ b/core/src/main/java/org/elasticsearch/search/sort/ScriptSortBuilder.java @@ -22,11 +22,8 @@ package org.elasticsearch.search.sort; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.script.Script; -import org.elasticsearch.script.ScriptService.ScriptType; import java.io.IOException; -import java.util.HashMap; -import java.util.Map; /** * Script sort builder allows to sort based on a custom script expression. @@ -35,17 +32,8 @@ public class ScriptSortBuilder extends SortBuilder { private Script script; - @Deprecated - private String scriptString; - private final String type; - @Deprecated - private String lang; - - @Deprecated - private Map params; - private SortOrder order; private String sortMode; @@ -65,66 +53,6 @@ public class ScriptSortBuilder extends SortBuilder { this.type = type; } - /** - * Constructs a script sort builder with the script and the type. - * - * @param script - * The script to use. - * @param type - * The type, can either be "string" or "number". - * - * @deprecated Use {@link #ScriptSortBuilder(Script, String)} instead. - */ - @Deprecated - public ScriptSortBuilder(String script, String type) { - this.scriptString = script; - this.type = type; - } - - /** - * Adds a parameter to the script. - * - * @param name - * The name of the parameter. - * @param value - * The value of the parameter. - * - * @deprecated Use {@link #ScriptSortBuilder(Script, String)} instead. - */ - @Deprecated - public ScriptSortBuilder param(String name, Object value) { - if (params == null) { - params = new HashMap<>(); - } - params.put(name, value); - return this; - } - - /** - * Sets parameters for the script. - * - * @param params - * The script parameters - * - * @deprecated Use {@link #ScriptSortBuilder(Script, String)} instead. - */ - @Deprecated - public ScriptSortBuilder setParams(Map params) { - this.params = params; - return this; - } - - /** - * The language of the script. - * - * @deprecated Use {@link #ScriptSortBuilder(Script, String)} instead. - */ - @Deprecated - public ScriptSortBuilder lang(String lang) { - this.lang = lang; - return this; - } - /** * Sets the sort order. */ @@ -172,12 +100,7 @@ public class ScriptSortBuilder extends SortBuilder { @Override public XContentBuilder toXContent(XContentBuilder builder, Params builderParams) throws IOException { builder.startObject("_script"); - if (script == null) { - - builder.field("script", new Script(scriptString, ScriptType.INLINE, lang, params)); - } else { - builder.field("script", script); - } + builder.field("script", script); builder.field("type", type); if (order == SortOrder.DESC) { builder.field("reverse", true); @@ -189,7 +112,7 @@ public class ScriptSortBuilder extends SortBuilder { builder.field("nested_path", nestedPath); } if (nestedFilter != null) { - builder.field("nested_filter", nestedFilter, params); + builder.field("nested_filter", nestedFilter, builderParams); } builder.endObject(); return builder; diff --git a/core/src/main/java/org/elasticsearch/search/sort/SortBuilders.java b/core/src/main/java/org/elasticsearch/search/sort/SortBuilders.java index 01134ca2648..9a843c43f74 100644 --- a/core/src/main/java/org/elasticsearch/search/sort/SortBuilders.java +++ b/core/src/main/java/org/elasticsearch/search/sort/SortBuilders.java @@ -54,20 +54,6 @@ public class SortBuilders { return new ScriptSortBuilder(script, type); } - /** - * Constructs a new script based sort. - * - * @param script - * The script to use. - * @param type - * The type, can either be "string" or "number". - * @deprecated Use {@link #scriptSort(Script, String)} instead. - */ - @Deprecated - public static ScriptSortBuilder scriptSort(String script, String type) { - return new ScriptSortBuilder(script, type); - } - /** * A geo distance based sort. *