Skip to content

Commit 42db84d

Browse files
MINOR: Remove Some Dead Code in Scripting
* The is default check method is not used in ScriptType * The removed vars on ExpressionSearchScript are unused
1 parent 2fa09f0 commit 42db84d

File tree

2 files changed

+3
-17
lines changed

2 files changed

+3
-17
lines changed

modules/lang-expression/src/main/java/org/elasticsearch/script/expression/ExpressionSearchScript.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import org.apache.lucene.index.LeafReaderContext;
2626
import org.apache.lucene.search.DoubleValues;
2727
import org.apache.lucene.search.DoubleValuesSource;
28-
import org.apache.lucene.search.Scorer;
2928
import org.elasticsearch.script.GeneralScriptException;
3029
import org.elasticsearch.script.SearchScript;
3130

@@ -42,8 +41,6 @@ class ExpressionSearchScript implements SearchScript.LeafFactory {
4241
final DoubleValuesSource source;
4342
final ReplaceableConstDoubleValueSource specialValue; // _value
4443
final boolean needsScores;
45-
Scorer scorer;
46-
int docid;
4744

4845
ExpressionSearchScript(Expression e, SimpleBindings b, ReplaceableConstDoubleValueSource v, boolean needsScores) {
4946
exprScript = e;

server/src/main/java/org/elasticsearch/script/ScriptType.java

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public enum ScriptType implements Writeable {
4141
* (Groovy and others), but can be overridden by the specific {@link ScriptEngine}
4242
* if the language is naturally secure (Painless, Mustache, and Expressions).
4343
*/
44-
INLINE ( 0 , new ParseField("source", "inline") , false ),
44+
INLINE ( 0 , new ParseField("source", "inline")),
4545

4646
/**
4747
* STORED scripts are saved as part of the {@link org.elasticsearch.cluster.ClusterState}
@@ -50,7 +50,7 @@ public enum ScriptType implements Writeable {
5050
* (Groovy and others), but can be overridden by the specific {@link ScriptEngine}
5151
* if the language is naturally secure (Painless, Mustache, and Expressions).
5252
*/
53-
STORED ( 1 , new ParseField("id", "stored") , false );
53+
STORED ( 1 , new ParseField("id", "stored"));
5454

5555
/**
5656
* Reads an int from the input stream and converts it to a {@link ScriptType}.
@@ -73,18 +73,15 @@ public static ScriptType readFrom(StreamInput in) throws IOException {
7373

7474
private final int id;
7575
private final ParseField parseField;
76-
private final boolean defaultEnabled;
7776

7877
/**
7978
* Standard constructor.
8079
* @param id A unique identifier for a type that can be read/written to a stream.
8180
* @param parseField Specifies the name used to parse input from queries.
82-
* @param defaultEnabled Whether or not a {@link ScriptType} can be run by default.
8381
*/
84-
ScriptType(int id, ParseField parseField, boolean defaultEnabled) {
82+
ScriptType(int id, ParseField parseField) {
8583
this.id = id;
8684
this.parseField = parseField;
87-
this.defaultEnabled = defaultEnabled;
8885
}
8986

9087
public void writeTo(StreamOutput out) throws IOException {
@@ -112,14 +109,6 @@ public ParseField getParseField() {
112109
return parseField;
113110
}
114111

115-
/**
116-
* @return Whether or not a {@link ScriptType} can be run by default. Note
117-
* this can be potentially overridden by any {@link ScriptEngine}.
118-
*/
119-
public boolean isDefaultEnabled() {
120-
return defaultEnabled;
121-
}
122-
123112
/**
124113
* @return The same as calling {@link #getName()}.
125114
*/

0 commit comments

Comments
 (0)