mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-17 10:25:15 +00:00
hack
This commit is contained in:
parent
02cf429e53
commit
546aed8390
@ -0,0 +1,5 @@
|
|||||||
|
package org.elasticsearch.painless;
|
||||||
|
|
||||||
|
/** Marker interface that a generated {@link Executable} uses the {@code _score} value */
|
||||||
|
public interface NeedsScore {
|
||||||
|
}
|
@ -135,7 +135,14 @@ class Writer extends PainlessParserBaseVisitor<Void> {
|
|||||||
final String base = BASE_CLASS_TYPE.getInternalName();
|
final String base = BASE_CLASS_TYPE.getInternalName();
|
||||||
final String name = CLASS_TYPE.getInternalName();
|
final String name = CLASS_TYPE.getInternalName();
|
||||||
|
|
||||||
writer.visit(version, access, name, null, base, null);
|
// apply marker interface NeedsScore if we use the score!
|
||||||
|
final String interfaces[];
|
||||||
|
if (metadata.scoreValueUsed) {
|
||||||
|
interfaces = new String[] { WriterConstants.NEEDS_SCORE_TYPE.getInternalName() };
|
||||||
|
} else {
|
||||||
|
interfaces = null;
|
||||||
|
}
|
||||||
|
writer.visit(version, access, name, null, base, interfaces);
|
||||||
writer.visitSource(source, null);
|
writer.visitSource(source, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,6 +44,8 @@ class WriterConstants {
|
|||||||
|
|
||||||
final static Type DEFINITION_TYPE = Type.getType(Definition.class);
|
final static Type DEFINITION_TYPE = Type.getType(Definition.class);
|
||||||
|
|
||||||
|
final static Type NEEDS_SCORE_TYPE = Type.getType(NeedsScore.class);
|
||||||
|
|
||||||
final static Type OBJECT_TYPE = Type.getType(Object.class);
|
final static Type OBJECT_TYPE = Type.getType(Object.class);
|
||||||
|
|
||||||
final static Type MAP_TYPE = Type.getType(Map.class);
|
final static Type MAP_TYPE = Type.getType(Map.class);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user