painless: _score as double, not float
This commit is contained in:
parent
866a5459f0
commit
d790c76636
|
@ -108,8 +108,8 @@ class Analyzer extends PainlessParserBaseVisitor<Void> {
|
|||
//
|
||||
// loop counter to catch runaway scripts. internal use only.
|
||||
metadata.loopCounterSlot = utility.addVariable(null, "#loop", definition.intType).slot;
|
||||
// document's score as a read-only float.
|
||||
metadata.scoreValueSlot = utility.addVariable(null, "_score", definition.floatType).slot;
|
||||
// document's score as a read-only double.
|
||||
metadata.scoreValueSlot = utility.addVariable(null, "_score", definition.doubleType).slot;
|
||||
// ctx map set by executable scripts as a read-only map.
|
||||
metadata.ctxValueSlot = utility.addVariable(null, "ctx", definition.smapType).slot;
|
||||
|
||||
|
|
|
@ -152,15 +152,16 @@ class Writer extends PainlessParserBaseVisitor<Void> {
|
|||
private void writeExecute() {
|
||||
if (metadata.scoreValueUsed) {
|
||||
// if the _score value is used, we do this once:
|
||||
// float _score = scorer.score();
|
||||
// final double _score = scorer.score();
|
||||
execute.visitVarInsn(Opcodes.ALOAD, metadata.scorerValueSlot);
|
||||
execute.invokeVirtual(WriterConstants.SCORER_TYPE, WriterConstants.SCORER_SCORE);
|
||||
execute.visitVarInsn(Opcodes.FSTORE, metadata.scoreValueSlot);
|
||||
execute.visitInsn(Opcodes.F2D);
|
||||
execute.visitVarInsn(Opcodes.DSTORE, metadata.scoreValueSlot);
|
||||
}
|
||||
|
||||
if (metadata.ctxValueUsed) {
|
||||
// if the _ctx value is used, we do this once:
|
||||
// Map<String,Object> ctx = input.get("ctx");
|
||||
// final Map<String,Object> ctx = input.get("ctx");
|
||||
execute.visitVarInsn(Opcodes.ALOAD, metadata.inputValueSlot);
|
||||
execute.push("ctx");
|
||||
execute.invokeInterface(WriterConstants.MAP_TYPE, WriterConstants.MAP_GET);
|
||||
|
|
Loading…
Reference in New Issue