diff options
author | Arne H Juul <arnej@yahooinc.com> | 2022-02-25 08:45:45 +0000 |
---|---|---|
committer | Arne H Juul <arnej@yahooinc.com> | 2022-02-25 12:51:30 +0000 |
commit | 00e179e7dbb3c2eeb5159938e90f7e73d8f5f55d (patch) | |
tree | 30c09e8affbebeb9132100b04703dec372e36718 /config-model/src/main | |
parent | fc9db2992f799bffb80df2b1d57bd4f320da5e7e (diff) |
also keep mutate operations
Diffstat (limited to 'config-model/src/main')
-rw-r--r-- | config-model/src/main/java/com/yahoo/searchdefinition/RankProfile.java | 4 | ||||
-rw-r--r-- | config-model/src/main/java/com/yahoo/searchdefinition/parser/ParsedRankProfile.java | 6 |
2 files changed, 7 insertions, 3 deletions
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/RankProfile.java b/config-model/src/main/java/com/yahoo/searchdefinition/RankProfile.java index 702eba8c8b5..6960a0a8afd 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/RankProfile.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/RankProfile.java @@ -775,7 +775,7 @@ public class RankProfile implements Cloneable { final Phase phase; final String attribute; final String operation; - MutateOperation(Phase phase, String attribute, String operation) { + public MutateOperation(Phase phase, String attribute, String operation) { this.phase = phase; this.attribute = attribute; this.operation = operation; @@ -785,7 +785,7 @@ public class RankProfile implements Cloneable { public void addMutateOperation(MutateOperation.Phase phase, String attribute, String operation) { mutateOperations.add(new MutateOperation(phase, attribute, operation)); - String prefix = "vespa.mutate." + phase.toString().replace('-', '_'); + String prefix = "vespa.mutate." + phase.toString(); addRankProperty(prefix + ".attribute", attribute); addRankProperty(prefix + ".operation", operation); } diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/parser/ParsedRankProfile.java b/config-model/src/main/java/com/yahoo/searchdefinition/parser/ParsedRankProfile.java index 6fce026948d..2011ac24148 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/parser/ParsedRankProfile.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/parser/ParsedRankProfile.java @@ -39,6 +39,7 @@ class ParsedRankProfile extends ParsedBlock { private String inheritedMatchFeatures = null; private String secondPhaseExpression = null; private Boolean strict = null; + private final List<MutateOperation> mutateOperations = new ArrayList<>(); private final List<String> inherited = new ArrayList<>(); private final Map<String, Boolean> fieldsRankFilter = new HashMap<>(); private final Map<String, Integer> fieldsRankWeight = new HashMap<>(); @@ -66,6 +67,7 @@ class ParsedRankProfile extends ParsedBlock { Optional<String> getFirstPhaseExpression() { return Optional.ofNullable(this.firstPhaseExpression); } Optional<String> getInheritedMatchFeatures() { return Optional.ofNullable(this.inheritedMatchFeatures); } List<ParsedRankFunction> getFunctions() { return List.copyOf(functions.values()); } + List<MutateOperation> getMutateOperations() { return List.copyOf(mutateOperations); } List<String> getInherited() { return List.copyOf(inherited); } Map<String, Boolean> getFieldsWithRankFilter() { return Map.copyOf(fieldsRankFilter); } Map<String, Integer> getFieldsWithRankWeight() { return Map.copyOf(fieldsRankWeight); } @@ -127,7 +129,9 @@ class ParsedRankProfile extends ParsedBlock { functions.put(func.name(), func); } - void addMutateOperation(MutateOperation.Phase phase, String attrName, String operation) {} + void addMutateOperation(MutateOperation.Phase phase, String attrName, String operation) { + mutateOperations.add(new MutateOperation(phase, attrName, operation)); + } void addRankProperty(String key, String value) { verifyThat(! rankProperties.containsKey(key), "already has value for rank property", key); |