summaryrefslogtreecommitdiffstats
path: root/config-model/src/main
diff options
context:
space:
mode:
authorArne Juul <arnej@yahooinc.com>2023-11-16 14:52:47 +0000
committerArne Juul <arnej@yahooinc.com>2023-11-16 19:01:17 +0000
commit16ab76c8e668b90177438c1e793a253f48eb55f0 (patch)
treeab767179bf346ab49853bcfcc2ab2ab264c1e11f /config-model/src/main
parentacd4ebf2718a4d80998b87a57c4b046e56f8e3e0 (diff)
always process with SerializationContext (needed by unpack_bits)
Diffstat (limited to 'config-model/src/main')
-rw-r--r--config-model/src/main/java/com/yahoo/schema/derived/RawRankProfile.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/config-model/src/main/java/com/yahoo/schema/derived/RawRankProfile.java b/config-model/src/main/java/com/yahoo/schema/derived/RawRankProfile.java
index 87b79ddcdc3..8606599f530 100644
--- a/config-model/src/main/java/com/yahoo/schema/derived/RawRankProfile.java
+++ b/config-model/src/main/java/com/yahoo/schema/derived/RawRankProfile.java
@@ -186,6 +186,7 @@ public class RawRankProfile implements RankProfilesConfig.Producer {
private RankingExpression secondPhaseRanking;
private RankingExpression globalPhaseRanking;
private final int globalPhaseRerankCount;
+ private final SerializationContext functionSerializationContext;
/**
* Creates a raw rank profile from the given rank profile
@@ -225,7 +226,7 @@ public class RawRankProfile implements RankProfilesConfig.Producer {
List<ExpressionFunction> functionExpressions = functions.values().stream().map(RankProfile.RankingExpressionFunction::function).toList();
Map<String, String> functionProperties = new LinkedHashMap<>();
var typeContext = compiled.typeContext(queryProfiles);
- SerializationContext functionSerializationContext = new SerializationContext(functionExpressions, Map.of(), typeContext);
+ this.functionSerializationContext = new SerializationContext(functionExpressions, Map.of(), typeContext);
if (firstPhaseRanking != null) {
functionProperties.putAll(firstPhaseRanking.getRankProperties(functionSerializationContext));
}
@@ -265,8 +266,6 @@ public class RawRankProfile implements RankProfilesConfig.Producer {
private void derivePropertiesAndFeaturesFromFunctions(Map<String, RankProfile.RankingExpressionFunction> functions,
Map<String, String> functionProperties,
SerializationContext functionContext) {
- if (functions.isEmpty()) return;
-
replaceFunctionFeatures(summaryFeatures, functionContext);
replaceFunctionFeatures(matchFeatures, functionContext);
@@ -556,11 +555,12 @@ public class RawRankProfile implements RankProfilesConfig.Producer {
if ("".equals(name))
name = phase;
+ String expressionAsString = expression.getRoot().toString(functionSerializationContext).toString();
if (expression.getRoot() instanceof ReferenceNode) {
- properties.add(new Pair<>("vespa.rank." + phase, expression.getRoot().toString()));
+ properties.add(new Pair<>("vespa.rank." + phase, expressionAsString));
} else {
properties.add(new Pair<>("vespa.rank." + phase, wrapInRankingExpression(name)));
- properties.add(new Pair<>(RankingExpression.propertyName(name), expression.getRoot().toString()));
+ properties.add(new Pair<>(RankingExpression.propertyName(name), expressionAsString));
}
return properties;
}