Skip to content

Commit

Permalink
Script: Remove FieldAccess (elastic#76109)
Browse files Browse the repository at this point in the history
Remove FieldAccess inner class from fields api classes
based on changes in elastic#76045
  • Loading branch information
stu-elastic authored Aug 4, 2021
1 parent b8c5332 commit 858cc32
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,8 @@

# The whitelist for the fields api

# The scripts must be whitelisted for painless to find the classes
# The scripts must be whitelisted for painless to find the classes for the field API
class org.elasticsearch.script.NumberSortScript @no_import {
}
class org.elasticsearch.script.NumberSortScript$Factory @no_import {
}

# Class bindings
static_import {
org.elasticsearch.script.Field field(org.elasticsearch.script.NumberSortScript, String) bound_to org.elasticsearch.script.NumberSortScript$FieldAccess
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,8 @@

# The whitelist for the fields api

# The scripts must be whitelisted for painless to find the classes
# The scripts must be whitelisted for painless to find the classes for the field API
class org.elasticsearch.script.ScoreScript @no_import {
}
class org.elasticsearch.script.ScoreScript$Factory @no_import {
}

# Class bindings
static_import {
org.elasticsearch.script.Field field(org.elasticsearch.script.ScoreScript, String) bound_to org.elasticsearch.script.ScoreScript$FieldAccess
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,8 @@
#

# The whitelist for the fields api
# The scripts must be whitelisted for painless to find the classes
# The scripts must be whitelisted for painless to find the classes for the field API
class org.elasticsearch.script.StringSortScript @no_import {
}
class org.elasticsearch.script.StringSortScript$Factory @no_import {
}

# Class bindings
static_import {
org.elasticsearch.script.Field field(org.elasticsearch.script.StringSortScript, String) bound_to org.elasticsearch.script.StringSortScript$FieldAccess
}
12 changes: 0 additions & 12 deletions server/src/main/java/org/elasticsearch/script/DocBasedScript.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,4 @@ public Map<String, ScriptDocValues<?>> getDoc() {
}
return docReader.doc();
}

public static class FieldAccess {
private final DocBasedScript script;

public FieldAccess(DocBasedScript script) {
this.script = script;
}

public Field<?> field(String fieldName) {
return script.field(fieldName);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,4 @@ public interface Factory extends ScriptFactory {
// in LeafFactory.newInstance to set fallbacks.
LeafFactory newFactory(Map<String, Object> params, SearchLookup searchLookup);
}

public static class FieldAccess {
private final NumberSortScript script;

public FieldAccess(NumberSortScript script) {
this.script = script;
}

public Field<?> field(String fieldName) {
return script.field(fieldName);
}
}
}
12 changes: 0 additions & 12 deletions server/src/main/java/org/elasticsearch/script/ScoreScript.java
Original file line number Diff line number Diff line change
Expand Up @@ -207,16 +207,4 @@ public interface Factory extends ScriptFactory {
}

public static final ScriptContext<ScoreScript.Factory> CONTEXT = new ScriptContext<>("score", ScoreScript.Factory.class);

public static class FieldAccess {
private final ScoreScript script;

public FieldAccess(ScoreScript script) {
this.script = script;
}

public Field<?> field(String fieldName) {
return script.field(fieldName);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,4 @@ public interface LeafFactory {
public interface Factory extends ScriptFactory {
LeafFactory newFactory(Map<String, Object> params);
}

public static class FieldAccess {
private final StringSortScript script;

public FieldAccess(StringSortScript script) {
this.script = script;
}

public Field<?> field(String fieldName) {
return script.field(fieldName);
}
}
}

0 comments on commit 858cc32

Please sign in to comment.