summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2021-11-03 16:56:45 +0100
committerHenning Baldersheim <balder@yahoo-inc.com>2021-11-03 16:56:45 +0100
commit4cc0c0885fd8b5f5e2fde130cfe409bbc9990455 (patch)
tree09e0d16df9c0db8b6bafaf82ee865844b86e5886
parent9d5f4971e89870ec61b1b309287c563ead7d8b75 (diff)
Add a LongValue to preserve integer numbers.
-rw-r--r--config-model/src/test/derived/neuralnet/rank-profiles.cfg86
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionInliningTestCase.java4
-rw-r--r--searchlib/abi-spec.json24
-rw-r--r--searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/evaluation/LongValue.java120
-rw-r--r--searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/evaluation/Value.java6
-rw-r--r--searchlib/src/test/java/com/yahoo/searchlib/gbdt/GbdtConverterTestCase.java18
-rw-r--r--searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/transform/ConstantDereferencerTestCase.java4
7 files changed, 204 insertions, 58 deletions
diff --git a/config-model/src/test/derived/neuralnet/rank-profiles.cfg b/config-model/src/test/derived/neuralnet/rank-profiles.cfg
index 4530bff2e20..34133b2a8b6 100644
--- a/config-model/src/test/derived/neuralnet/rank-profiles.cfg
+++ b/config-model/src/test/derived/neuralnet/rank-profiles.cfg
@@ -70,7 +70,7 @@ rankprofile[].fef.property[].value "if (isNan(attribute(createdAt)) == 1, rankin
rankprofile[].fef.property[].name "rankingExpression(laAtToUse).rankingScript"
rankprofile[].fef.property[].value "if (isNan(attribute(laAt)) == 1, attribute(createdAt), attribute(laAt))"
rankprofile[].fef.property[].name "rankingExpression(markedAsAAtToUse).rankingScript"
-rankprofile[].fef.property[].value "if (isNan(attribute(markedAsAAt)) == 1, 9.223372036854776E18, attribute(markedAsAAt))"
+rankprofile[].fef.property[].value "if (isNan(attribute(markedAsAAt)) == 1, 9223372036854775807, attribute(markedAsAAt))"
rankprofile[].fef.property[].name "rankingExpression(tdToUse).rankingScript"
rankprofile[].fef.property[].value "pow(2,0 - ((rankingExpression(rankedAt) - rankingExpression(createdAtToUse)) / query(decay)))"
rankprofile[].fef.property[].name "rankingExpression(commentOverallScore).rankingScript"
@@ -94,68 +94,44 @@ rankprofile[].fef.property[].value "tensor(hidden[9],out[9])"
rankprofile[].fef.property[].name "vespa.type.query.W_0"
rankprofile[].fef.property[].value "tensor(hidden[9],x[9])"
rankprofile[].name "neuralNetworkProfile"
-rankprofile[].fef.property[].name "rankingExpression(log10_1p).rankingScript"
-rankprofile[].fef.property[].value "log10(x + 1)"
-rankprofile[].fef.property[].name "rankingExpression(textScoreToUse).rankingScript"
-rankprofile[].fef.property[].value "if (isNan(attribute(normalizedTextScore)) == 1, 0, attribute(normalizedTextScore))"
-rankprofile[].fef.property[].name "rankingExpression(rCountToUse).rankingScript"
-rankprofile[].fef.property[].value "if (isNan(attribute(rCount)) == 1, 0, if (attribute(rCount) < 0, 0, attribute(rCount)))"
+rankprofile[].fef.property[].name "rankingExpression(freshnessRank).rankingScript"
+rankprofile[].fef.property[].value "nativeRank + freshness(createdAt)"
+rankprofile[].fef.property[].name "rankingExpression(aVoteCountToUse).rankingScript"
+rankprofile[].fef.property[].value "if (isNan(attribute(aVoteCount)) == 1, 0, if (attribute(aVoteCount) < 0, 0, attribute(aVoteCount)))"
+rankprofile[].fef.property[].name "rankingExpression(log10_1p@af9a8c53ba738798).rankingScript"
+rankprofile[].fef.property[].value "log10(rankingExpression(aVoteCountToUse) + 1)"
+rankprofile[].fef.property[].name "rankingExpression(dvCountToUse).rankingScript"
+rankprofile[].fef.property[].value "if (isNan(attribute(dvCount)) == 1, 0, if (attribute(dvCount) < 0, 0, attribute(dvCount)))"
+rankprofile[].fef.property[].name "rankingExpression(log10_1p@6ad21b437fe95dd9).rankingScript"
+rankprofile[].fef.property[].value "log10(rankingExpression(dvCountToUse) + 1)"
rankprofile[].fef.property[].name "rankingExpression(uniqueRCountToUse).rankingScript"
rankprofile[].fef.property[].value "if (isNan(attribute(uniqueRCount)) == 1, 0, if (attribute(uniqueRACount) < 0, 0, attribute(uniqueRACount)))"
+rankprofile[].fef.property[].name "rankingExpression(log10_1p@c05478688f81fe20).rankingScript"
+rankprofile[].fef.property[].value "log10(rankingExpression(uniqueRCountToUse) + 1)"
rankprofile[].fef.property[].name "rankingExpression(uvCountToUse).rankingScript"
rankprofile[].fef.property[].value "if (isNan(attribute(uvCount)) == 1, 0, if (attribute(uvCount) < 0, 0, attribute(uvCount)))"
-rankprofile[].fef.property[].name "rankingExpression(dvCountToUse).rankingScript"
-rankprofile[].fef.property[].value "if (isNan(attribute(dvCount)) == 1, 0, if (attribute(dvCount) < 0, 0, attribute(dvCount)))"
-rankprofile[].fef.property[].name "rankingExpression(aVoteCountToUse).rankingScript"
-rankprofile[].fef.property[].value "if (isNan(attribute(aVoteCount)) == 1, 0, if (attribute(aVoteCount) < 0, 0, attribute(aVoteCount)))"
-rankprofile[].fef.property[].name "rankingExpression(totalPR).rankingScript"
-rankprofile[].fef.property[].value "rankingExpression(uniqueRCountToUse) + query(voteToRRatio) * (rankingExpression(uvCountToUse) - rankingExpression(dvCountToUse)) - rankingExpression(aVoteCountToUse)"
+rankprofile[].fef.property[].name "rankingExpression(log10_1p@53f0a2c000e82f4).rankingScript"
+rankprofile[].fef.property[].value "log10(rankingExpression(uvCountToUse) + 1)"
rankprofile[].fef.property[].name "rankingExpression(totalvote).rankingScript"
rankprofile[].fef.property[].value "query(reportaweight) * rankingExpression(aVoteCountToUse) + rankingExpression(dvCountToUse) + query(rweight) * rankingExpression(uniqueRCountToUse) + rankingExpression(uvCountToUse)"
rankprofile[].fef.property[].name "rankingExpression(phat).rankingScript"
rankprofile[].fef.property[].value "if (rankingExpression(totalvote) == 0, 0, (query(rweight) * rankingExpression(uniqueRCountToUse) + rankingExpression(uvCountToUse)) / rankingExpression(totalvote))"
-rankprofile[].fef.property[].name "rankingExpression(nCScoreToUse).rankingScript"
-rankprofile[].fef.property[].value "if (rankingExpression(totalPR) > 0, log10(rankingExpression(totalPR)), 0)"
+rankprofile[].fef.property[].name "rankingExpression(log10_1p@d7da61ad34902e89).rankingScript"
+rankprofile[].fef.property[].value "log10(rankingExpression(totalvote) + 1)"
rankprofile[].fef.property[].name "rankingExpression(hsScoreToUse).rankingScript"
rankprofile[].fef.property[].value "attribute(hsScore)"
-rankprofile[].fef.property[].name "rankingExpression(tScoreToUse).rankingScript"
-rankprofile[].fef.property[].value "if (isNan(attribute(t)) == 1, 0.6, attribute(t))"
-rankprofile[].fef.property[].name "rankingExpression(relevanceScoreToUse).rankingScript"
-rankprofile[].fef.property[].value "if (isNan(attribute(relevance)) == 1, 0.254, attribute(relevance))"
-rankprofile[].fef.property[].name "rankingExpression(freshnessToUse).rankingScript"
-rankprofile[].fef.property[].value "if (freshness(createdAt).logscale < 0.01, 0.01, freshness(createdAt).logscale)"
rankprofile[].fef.property[].name "rankingExpression(rankedAt).rankingScript"
rankprofile[].fef.property[].value "now"
rankprofile[].fef.property[].name "rankingExpression(createdAtToUse).rankingScript"
rankprofile[].fef.property[].value "if (isNan(attribute(createdAt)) == 1, rankingExpression(rankedAt), attribute(createdAt))"
-rankprofile[].fef.property[].name "rankingExpression(laAtToUse).rankingScript"
-rankprofile[].fef.property[].value "if (isNan(attribute(laAt)) == 1, attribute(createdAt), attribute(laAt))"
-rankprofile[].fef.property[].name "rankingExpression(markedAsAAtToUse).rankingScript"
-rankprofile[].fef.property[].value "if (isNan(attribute(markedAsAAt)) == 1, 9.223372036854776E18, attribute(markedAsAAt))"
rankprofile[].fef.property[].name "rankingExpression(tdToUse).rankingScript"
rankprofile[].fef.property[].value "pow(2,0 - ((rankingExpression(rankedAt) - rankingExpression(createdAtToUse)) / query(decay)))"
-rankprofile[].fef.property[].name "rankingExpression(commentOverallScore).rankingScript"
-rankprofile[].fef.property[].value "query(textweight) * rankingExpression(textScoreToUse) + query(communityweight) * rankingExpression(nCScoreToUse)"
-rankprofile[].fef.property[].name "rankingExpression(pinScore).rankingScript"
-rankprofile[].fef.property[].value "if (isNan(attribute(pinned)) == 1, 0, query(pinweight) * attribute(pinned))"
-rankprofile[].fef.property[].name "rankingExpression(freshnessRank).rankingScript"
-rankprofile[].fef.property[].value "nativeRank + freshness(createdAt)"
-rankprofile[].fef.property[].name "rankingExpression(log10_1p@af9a8c53ba738798).rankingScript"
-rankprofile[].fef.property[].value "log10(rankingExpression(aVoteCountToUse) + 1)"
-rankprofile[].fef.property[].name "rankingExpression(log10_1p@6ad21b437fe95dd9).rankingScript"
-rankprofile[].fef.property[].value "log10(rankingExpression(dvCountToUse) + 1)"
-rankprofile[].fef.property[].name "rankingExpression(log10_1p@c05478688f81fe20).rankingScript"
-rankprofile[].fef.property[].value "log10(rankingExpression(uniqueRCountToUse) + 1)"
-rankprofile[].fef.property[].name "rankingExpression(log10_1p@53f0a2c000e82f4).rankingScript"
-rankprofile[].fef.property[].value "log10(rankingExpression(uvCountToUse) + 1)"
-rankprofile[].fef.property[].name "rankingExpression(log10_1p@d7da61ad34902e89).rankingScript"
-rankprofile[].fef.property[].value "log10(rankingExpression(totalvote) + 1)"
+rankprofile[].fef.property[].name "rankingExpression(tScoreToUse).rankingScript"
+rankprofile[].fef.property[].value "if (isNan(attribute(t)) == 1, 0.6, attribute(t))"
rankprofile[].fef.property[].name "rankingExpression(nn_input).rankingScript"
rankprofile[].fef.property[].value "concat(rankingExpression(log10_1p@af9a8c53ba738798), concat(rankingExpression(log10_1p@6ad21b437fe95dd9), concat(rankingExpression(log10_1p@c05478688f81fe20), concat(rankingExpression(log10_1p@53f0a2c000e82f4), concat(rankingExpression(phat), concat(rankingExpression(log10_1p@d7da61ad34902e89), concat(rankingExpression(hsScoreToUse), concat(rankingExpression(tdToUse), rankingExpression(tScoreToUse), x), x), x), x), x), x), x), x)"
rankprofile[].fef.property[].name "rankingExpression(nn_input).type"
rankprofile[].fef.property[].value "tensor(x[9])"
-rankprofile[].fef.property[].name "rankingExpression(get_model_weights).rankingScript"
-rankprofile[].fef.property[].value "if (query(field) == 0, constant(field), query(field))"
rankprofile[].fef.property[].name "rankingExpression(get_model_weights@1f2b4afc2c45fbee).rankingScript"
rankprofile[].fef.property[].value "if (query(W_0) == 0, constant(W_0), query(W_0))"
rankprofile[].fef.property[].name "rankingExpression(get_model_weights@e752cecc7900ff3e).rankingScript"
@@ -178,6 +154,30 @@ rankprofile[].fef.property[].name "rankingExpression(get_model_weights@23f46853c
rankprofile[].fef.property[].value "if (query(b_out) == 0, constant(b_out), query(b_out))"
rankprofile[].fef.property[].name "rankingExpression(layer_out).rankingScript"
rankprofile[].fef.property[].value "reduce(join(reduce(join(rankingExpression(layer_1), rankingExpression(get_model_weights@418462473aa32b7d), f(a,b)(a * b)), sum, out), rankingExpression(get_model_weights@23f46853cab72961), f(a,b)(a + b)), sum)"
+rankprofile[].fef.property[].name "rankingExpression(log10_1p).rankingScript"
+rankprofile[].fef.property[].value "log10(x + 1)"
+rankprofile[].fef.property[].name "rankingExpression(textScoreToUse).rankingScript"
+rankprofile[].fef.property[].value "if (isNan(attribute(normalizedTextScore)) == 1, 0, attribute(normalizedTextScore))"
+rankprofile[].fef.property[].name "rankingExpression(rCountToUse).rankingScript"
+rankprofile[].fef.property[].value "if (isNan(attribute(rCount)) == 1, 0, if (attribute(rCount) < 0, 0, attribute(rCount)))"
+rankprofile[].fef.property[].name "rankingExpression(totalPR).rankingScript"
+rankprofile[].fef.property[].value "rankingExpression(uniqueRCountToUse) + query(voteToRRatio) * (rankingExpression(uvCountToUse) - rankingExpression(dvCountToUse)) - rankingExpression(aVoteCountToUse)"
+rankprofile[].fef.property[].name "rankingExpression(nCScoreToUse).rankingScript"
+rankprofile[].fef.property[].value "if (rankingExpression(totalPR) > 0, log10(rankingExpression(totalPR)), 0)"
+rankprofile[].fef.property[].name "rankingExpression(relevanceScoreToUse).rankingScript"
+rankprofile[].fef.property[].value "if (isNan(attribute(relevance)) == 1, 0.254, attribute(relevance))"
+rankprofile[].fef.property[].name "rankingExpression(freshnessToUse).rankingScript"
+rankprofile[].fef.property[].value "if (freshness(createdAt).logscale < 0.01, 0.01, freshness(createdAt).logscale)"
+rankprofile[].fef.property[].name "rankingExpression(laAtToUse).rankingScript"
+rankprofile[].fef.property[].value "if (isNan(attribute(laAt)) == 1, attribute(createdAt), attribute(laAt))"
+rankprofile[].fef.property[].name "rankingExpression(markedAsAAtToUse).rankingScript"
+rankprofile[].fef.property[].value "if (isNan(attribute(markedAsAAt)) == 1, 9223372036854775807, attribute(markedAsAAt))"
+rankprofile[].fef.property[].name "rankingExpression(commentOverallScore).rankingScript"
+rankprofile[].fef.property[].value "query(textweight) * rankingExpression(textScoreToUse) + query(communityweight) * rankingExpression(nCScoreToUse)"
+rankprofile[].fef.property[].name "rankingExpression(pinScore).rankingScript"
+rankprofile[].fef.property[].value "if (isNan(attribute(pinned)) == 1, 0, query(pinweight) * attribute(pinned))"
+rankprofile[].fef.property[].name "rankingExpression(get_model_weights).rankingScript"
+rankprofile[].fef.property[].value "if (query(field) == 0, constant(field), query(field))"
rankprofile[].fef.property[].name "vespa.rank.firstphase"
rankprofile[].fef.property[].value "rankingExpression(freshnessRank)"
rankprofile[].fef.property[].name "vespa.rank.secondphase"
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionInliningTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionInliningTestCase.java
index 50c94ff38d4..0598fee538a 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionInliningTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionInliningTestCase.java
@@ -69,10 +69,10 @@ public class RankingExpressionInliningTestCase extends AbstractSchemaTestCase {
Schema s = builder.getSchema();
RankProfile parent = rankProfileRegistry.get(s, "parent").compile(new QueryProfileRegistry(), new ImportedMlModels());
- assertEquals("7.0 * (3 + attribute(a) + attribute(b) * (attribute(a) * 3 + if (7.0 < attribute(a), 1, 2) == 0))",
+ assertEquals("7 * (3 + attribute(a) + attribute(b) * (attribute(a) * 3 + if (7 < attribute(a), 1, 2) == 0))",
parent.getFirstPhaseRanking().getRoot().toString());
RankProfile child = rankProfileRegistry.get(s, "child").compile(new QueryProfileRegistry(), new ImportedMlModels());
- assertEquals("7.0 * (9 + attribute(a))",
+ assertEquals("7 * (9 + attribute(a))",
child.getFirstPhaseRanking().getRoot().toString());
}
diff --git a/searchlib/abi-spec.json b/searchlib/abi-spec.json
index d0e14a40b9c..cb9bcb0ad4f 100644
--- a/searchlib/abi-spec.json
+++ b/searchlib/abi-spec.json
@@ -580,6 +580,30 @@
],
"fields": []
},
+ "com.yahoo.searchlib.rankingexpression.evaluation.LongValue": {
+ "superClass": "com.yahoo.searchlib.rankingexpression.evaluation.DoubleCompatibleValue",
+ "interfaces": [],
+ "attributes": [
+ "public"
+ ],
+ "methods": [
+ "public void <init>(long)",
+ "public double asDouble()",
+ "public boolean asBoolean()",
+ "public com.yahoo.searchlib.rankingexpression.evaluation.Value asMutable()",
+ "public java.lang.String toString()",
+ "public boolean equals(java.lang.Object)",
+ "public int hashCode()",
+ "public com.yahoo.searchlib.rankingexpression.evaluation.DoubleValue negate()",
+ "public com.yahoo.searchlib.rankingexpression.evaluation.Value add(com.yahoo.searchlib.rankingexpression.evaluation.Value)",
+ "public com.yahoo.searchlib.rankingexpression.evaluation.Value subtract(com.yahoo.searchlib.rankingexpression.evaluation.Value)",
+ "public com.yahoo.searchlib.rankingexpression.evaluation.Value multiply(com.yahoo.searchlib.rankingexpression.evaluation.Value)",
+ "public com.yahoo.searchlib.rankingexpression.evaluation.Value divide(com.yahoo.searchlib.rankingexpression.evaluation.Value)",
+ "public com.yahoo.searchlib.rankingexpression.evaluation.Value modulo(com.yahoo.searchlib.rankingexpression.evaluation.Value)",
+ "public bridge synthetic com.yahoo.searchlib.rankingexpression.evaluation.Value negate()"
+ ],
+ "fields": []
+ },
"com.yahoo.searchlib.rankingexpression.evaluation.MapContext": {
"superClass": "com.yahoo.searchlib.rankingexpression.evaluation.Context",
"interfaces": [],
diff --git a/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/evaluation/LongValue.java b/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/evaluation/LongValue.java
new file mode 100644
index 00000000000..21a998d3234
--- /dev/null
+++ b/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/evaluation/LongValue.java
@@ -0,0 +1,120 @@
+// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.searchlib.rankingexpression.evaluation;
+
+/**
+ * A representation for integer numbers
+ *
+ * @author balder
+ */
+public class LongValue extends DoubleCompatibleValue {
+ private final long value;
+
+ public LongValue(long value) {
+ this.value = value;
+ }
+ @Override
+ public double asDouble() {
+ return value;
+ }
+ @Override
+ public boolean asBoolean() {
+ return value != 0;
+ }
+
+ @Override
+ public Value asMutable() {
+ return new LongValue(value);
+ }
+
+ @Override
+ public String toString() {
+ return String.valueOf(value);
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (this==other) return true;
+ if ( ! (other instanceof Value)) return false;
+ if ( ! ((Value) other).hasDouble()) return false;
+ return new DoubleValue(value).equals(other);
+ }
+
+ @Override
+ public int hashCode() {
+ return Long.hashCode(value);
+ }
+
+ @Override
+ public DoubleValue negate() {
+ return new DoubleValue(-value);
+ }
+
+ private UnsupportedOperationException unsupported(String operation, Value value) {
+ return new UnsupportedOperationException("Cannot perform " + operation + " on " + value + " and " + this);
+ }
+
+ /** Returns this or a mutable copy assigned the given value */
+ private DoubleValue mutable(double value) {
+ return new DoubleValue(value);
+ }
+
+ @Override
+ public Value add(Value value) {
+ if (value instanceof TensorValue)
+ return value.add(this);
+
+ try {
+ return mutable(this.value + value.asDouble());
+ }
+ catch (UnsupportedOperationException e) {
+ throw unsupported("add",value);
+ }
+ }
+
+ @Override
+ public Value subtract(Value value) {
+ if (value instanceof TensorValue)
+ return value.negate().add(this);
+
+ try {
+ return mutable(this.value - value.asDouble());
+ }
+ catch (UnsupportedOperationException e) {
+ throw unsupported("subtract",value);
+ }
+ }
+
+ @Override
+ public Value multiply(Value value) {
+ if (value instanceof TensorValue)
+ return value.multiply(this);
+
+ try {
+ return mutable(this.value * value.asDouble());
+ }
+ catch (UnsupportedOperationException e) {
+ throw unsupported("multiply", value);
+ }
+ }
+
+ @Override
+ public Value divide(Value value) {
+ try {
+ return mutable(this.value / value.asDouble());
+ }
+ catch (UnsupportedOperationException e) {
+ throw unsupported("divide",value);
+ }
+ }
+
+ @Override
+ public Value modulo(Value value) {
+ try {
+ return mutable(this.value % value.asDouble());
+ }
+ catch (UnsupportedOperationException e) {
+ throw unsupported("modulo",value);
+ }
+ }
+
+}
diff --git a/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/evaluation/Value.java b/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/evaluation/Value.java
index 793a0516be3..6490c69894f 100644
--- a/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/evaluation/Value.java
+++ b/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/evaluation/Value.java
@@ -116,8 +116,10 @@ public abstract class Value {
return new StringValue(value);
else if (value.startsWith("{"))
return new TensorValue(Tensor.from(value));
- else
- return new DoubleValue(Double.parseDouble(value));
+ else if ((value.indexOf('.') == -1) && (value.indexOf('e') == -1) && (value.indexOf('E') == -1))
+ return new LongValue(Long.parseLong(value));
+ else
+ return new DoubleValue(Double.parseDouble(value));
}
public static Value of(Tensor tensor) {
diff --git a/searchlib/src/test/java/com/yahoo/searchlib/gbdt/GbdtConverterTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/gbdt/GbdtConverterTestCase.java
index 0a0a975778c..fa54af25481 100644
--- a/searchlib/src/test/java/com/yahoo/searchlib/gbdt/GbdtConverterTestCase.java
+++ b/searchlib/src/test/java/com/yahoo/searchlib/gbdt/GbdtConverterTestCase.java
@@ -84,16 +84,16 @@ public class GbdtConverterTestCase {
@Test
public void testSetTestsWork() throws Exception {
assertConvert("src/test/files/gbdt_set_inclusion_test.xml",
- "if (AGE_GROUP$ in [2.0], if (EDUCATION_LEVEL$ in [0.0], -0.25, 0.125), if (AGE_GROUP$ in [1.0], 0.125, 0.25)) +\n" +
- "if (AGE_GROUP$ in [2.0], if (EDUCATION_LEVEL$ in [0.0], -0.2189117, -0.0), if (EDUCATION_LEVEL$ in [0.0], 0.1094559, 0.2343953)) +\n" +
- "if (AGE_GROUP$ in [2.0], -0.0962185, if (EDUCATION_LEVEL$ in [0.0], if (AGE_GROUP$ in [1.0], 0.0, 0.2055456), 0.205553)) +\n" +
- "if (EDUCATION_LEVEL$ in [0.0], 0.0905977, 0.1812016) +\n" +
- "if (EDUCATION_LEVEL$ in [0.0, 1.0], if (AGE_GROUP$ in [2.0], if (EDUCATION_LEVEL$ in [0.0], -0.191772, -0.0), if (AGE_GROUP$ in [1.0], if (EDUCATION_LEVEL$ in [0.0], 0.0, 0.1608304), 0.1708644)), 0.1923393) +\n" +
- "if (EDUCATION_LEVEL$ in [\"foo\", \"bar\"], if (AGE_GROUP$ in [2.0], if (EDUCATION_LEVEL$ in [\"baz\"], -0.1696624, -0.0), if (AGE_GROUP$ in [1.0], if (EDUCATION_LEVEL$ in [0.0], 0.0, 0.1438091), 0.1521967)), 0.2003772) +\n" +
+ "if (AGE_GROUP$ in [2], if (EDUCATION_LEVEL$ in [0], -0.25, 0.125), if (AGE_GROUP$ in [1], 0.125, 0.25)) +\n" +
+ "if (AGE_GROUP$ in [2], if (EDUCATION_LEVEL$ in [0], -0.2189117, -0.0), if (EDUCATION_LEVEL$ in [0], 0.1094559, 0.2343953)) +\n" +
+ "if (AGE_GROUP$ in [2], -0.0962185, if (EDUCATION_LEVEL$ in [0], if (AGE_GROUP$ in [1], 0.0, 0.2055456), 0.205553)) +\n" +
+ "if (EDUCATION_LEVEL$ in [0], 0.0905977, 0.1812016) +\n" +
+ "if (EDUCATION_LEVEL$ in [0, 1], if (AGE_GROUP$ in [2], if (EDUCATION_LEVEL$ in [0], -0.191772, -0.0), if (AGE_GROUP$ in [1], if (EDUCATION_LEVEL$ in [0], 0.0, 0.1608304), 0.1708644)), 0.1923393) +\n" +
+ "if (EDUCATION_LEVEL$ in [\"foo\", \"bar\"], if (AGE_GROUP$ in [2], if (EDUCATION_LEVEL$ in [\"baz\"], -0.1696624, -0.0), if (AGE_GROUP$ in [1], if (EDUCATION_LEVEL$ in [0], 0.0, 0.1438091), 0.1521967)), 0.2003772) +\n" +
"if (value(0) < 1.0, -0.0108278, 0.0) +\n" +
- "if (EDUCATION_LEVEL$ in [0.0], -0.1500528, if (GENDER$ in [1.0], 0.0652894, 0.1543407)) +\n" +
- "if (AGE_GROUP$ in [1.0], 0.0, 0.1569706) +\n" +
- "if (AGE_GROUP$ in [1.0], 0.0, if (EDUCATION_LEVEL$ in [1.0], 0.0, 0.1405829))\n" +
+ "if (EDUCATION_LEVEL$ in [0], -0.1500528, if (GENDER$ in [1], 0.0652894, 0.1543407)) +\n" +
+ "if (AGE_GROUP$ in [1], 0.0, 0.1569706) +\n" +
+ "if (AGE_GROUP$ in [1], 0.0, if (EDUCATION_LEVEL$ in [1], 0.0, 0.1405829))\n" +
"\n");
}
diff --git a/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/transform/ConstantDereferencerTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/transform/ConstantDereferencerTestCase.java
index c7eab014104..ac148cbedfb 100644
--- a/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/transform/ConstantDereferencerTestCase.java
+++ b/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/transform/ConstantDereferencerTestCase.java
@@ -27,8 +27,8 @@ public class ConstantDereferencerTestCase {
constants.put("c", Value.parse("3.5"));
TransformContext context = new TransformContext(constants, new MapTypeContext());
- assertEquals("1.0 + 2.0 + 3.5", c.transform(new RankingExpression("a + b + c"), context).toString());
- assertEquals("myFunction(1.0,2.0)", c.transform(new RankingExpression("myFunction(a, b)"), context).toString());
+ assertEquals("1.0 + 2 + 3.5", c.transform(new RankingExpression("a + b + c"), context).toString());
+ assertEquals("myFunction(1.0,2)", c.transform(new RankingExpression("myFunction(a, b)"), context).toString());
assertEquals("tensor(x[2],y[3])((x + y == 1.0))", c.transform(new RankingExpression("tensor(x[2],y[3])(x+y==a)"), context).toString());
}