Skip to content

MINOR: Remove Some Dead Code in Scripting #33800

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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