Skip to content

Commit

Permalink
MINOR: Remove Some Dead Code in Scripting
Browse files Browse the repository at this point in the history
* The is default check method is not used in ScriptType
* The removed vars on ExpressionSearchScript are unused
  • Loading branch information
original-brownbear committed Sep 18, 2018
1 parent 2fa09f0 commit 42db84d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.search.DoubleValues;
import org.apache.lucene.search.DoubleValuesSource;
import org.apache.lucene.search.Scorer;
import org.elasticsearch.script.GeneralScriptException;
import org.elasticsearch.script.SearchScript;

Expand All @@ -42,8 +41,6 @@ class ExpressionSearchScript implements SearchScript.LeafFactory {
final DoubleValuesSource source;
final ReplaceableConstDoubleValueSource specialValue; // _value
final boolean needsScores;
Scorer scorer;
int docid;

ExpressionSearchScript(Expression e, SimpleBindings b, ReplaceableConstDoubleValueSource v, boolean needsScores) {
exprScript = e;
Expand Down
17 changes: 3 additions & 14 deletions server/src/main/java/org/elasticsearch/script/ScriptType.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public enum ScriptType implements Writeable {
* (Groovy and others), but can be overridden by the specific {@link ScriptEngine}
* if the language is naturally secure (Painless, Mustache, and Expressions).
*/
INLINE ( 0 , new ParseField("source", "inline") , false ),
INLINE ( 0 , new ParseField("source", "inline")),

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

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

private final int id;
private final ParseField parseField;
private final boolean defaultEnabled;

/**
* Standard constructor.
* @param id A unique identifier for a type that can be read/written to a stream.
* @param parseField Specifies the name used to parse input from queries.
* @param defaultEnabled Whether or not a {@link ScriptType} can be run by default.
*/
ScriptType(int id, ParseField parseField, boolean defaultEnabled) {
ScriptType(int id, ParseField parseField) {
this.id = id;
this.parseField = parseField;
this.defaultEnabled = defaultEnabled;
}

public void writeTo(StreamOutput out) throws IOException {
Expand Down Expand Up @@ -112,14 +109,6 @@ public ParseField getParseField() {
return parseField;
}

/**
* @return Whether or not a {@link ScriptType} can be run by default. Note
* this can be potentially overridden by any {@link ScriptEngine}.
*/
public boolean isDefaultEnabled() {
return defaultEnabled;
}

/**
* @return The same as calling {@link #getName()}.
*/
Expand Down

0 comments on commit 42db84d

Please sign in to comment.