diff options
author | Arne H Juul <arnej27959@users.noreply.github.com> | 2023-10-26 14:19:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-26 14:19:01 +0200 |
commit | 91427cfbc638ab534f3f4c34125b231fd8d72140 (patch) | |
tree | 6a05e929133bb24b304f38c6f6d8dc66c2dfc7ca | |
parent | 36b10916a10248ec06abe5745e3a49007165a6b9 (diff) | |
parent | c209471ff48aaec61d2004d6824fb5b0ac704827 (diff) |
Merge pull request #29114 from vespa-engine/arnej/avoid-losing-inherited-match-features
avoid losing inherited match-features when adding implicit ones
3 files changed, 66 insertions, 2 deletions
diff --git a/config-model/src/main/java/com/yahoo/schema/RankProfile.java b/config-model/src/main/java/com/yahoo/schema/RankProfile.java index e2577f4f834..0cfcddc6c57 100644 --- a/config-model/src/main/java/com/yahoo/schema/RankProfile.java +++ b/config-model/src/main/java/com/yahoo/schema/RankProfile.java @@ -628,8 +628,10 @@ public class RankProfile implements Cloneable { } private void addImplicitMatchFeatures(List<FeatureList> list) { - if (matchFeatures == null) - matchFeatures = new LinkedHashSet<>(); + if (matchFeatures == null) { + var inherited = getMatchFeatures(); + matchFeatures = new LinkedHashSet<>(inherited); + } if (hiddenMatchFeatures == null) hiddenMatchFeatures = new LinkedHashSet<>(); for (var features : list) { diff --git a/config-model/src/test/derived/globalphase_token_functions/rank-profiles.cfg b/config-model/src/test/derived/globalphase_token_functions/rank-profiles.cfg index 37d84c1a2d9..d0336e31744 100644 --- a/config-model/src/test/derived/globalphase_token_functions/rank-profiles.cfg +++ b/config-model/src/test/derived/globalphase_token_functions/rank-profiles.cfg @@ -49,3 +49,46 @@ rankprofile[].fef.property[].name "vespa.type.attribute.tokens" rankprofile[].fef.property[].value "tensor(d0[128])" rankprofile[].fef.property[].name "vespa.type.query.input" rankprofile[].fef.property[].value "tensor(d0[32])" +rankprofile[].name "with-fun" +rankprofile[].fef.property[].name "rankingExpression(use_model).rankingScript" +rankprofile[].fef.property[].value "attribute(outputidx) + 1.0" +rankprofile[].fef.property[].name "vespa.rank.globalphase" +rankprofile[].fef.property[].value "rankingExpression(use_model)" +rankprofile[].fef.property[].name "vespa.match.feature" +rankprofile[].fef.property[].value "attribute(outputidx)" +rankprofile[].fef.property[].name "vespa.hidden.matchfeature" +rankprofile[].fef.property[].value "attribute(outputidx)" +rankprofile[].fef.property[].name "vespa.type.attribute.tokens" +rankprofile[].fef.property[].value "tensor(d0[128])" +rankprofile[].name "with-fun-mf" +rankprofile[].fef.property[].name "rankingExpression(use_model).rankingScript" +rankprofile[].fef.property[].value "attribute(outputidx) + 1.0" +rankprofile[].fef.property[].name "vespa.rank.firstphase" +rankprofile[].fef.property[].value "nativeRank" +rankprofile[].fef.property[].name "vespa.rank.globalphase" +rankprofile[].fef.property[].value "rankingExpression(use_model)" +rankprofile[].fef.property[].name "vespa.match.feature" +rankprofile[].fef.property[].value "rankingExpression(use_model)" +rankprofile[].fef.property[].name "vespa.feature.rename" +rankprofile[].fef.property[].value "rankingExpression(use_model)" +rankprofile[].fef.property[].name "vespa.feature.rename" +rankprofile[].fef.property[].value "use_model" +rankprofile[].fef.property[].name "vespa.type.attribute.tokens" +rankprofile[].fef.property[].value "tensor(d0[128])" +rankprofile[].name "fun-mf-child" +rankprofile[].fef.property[].name "rankingExpression(use_model).rankingScript" +rankprofile[].fef.property[].value "attribute(outputidx) + 1.0" +rankprofile[].fef.property[].name "vespa.rank.firstphase" +rankprofile[].fef.property[].value "rankingExpression(firstphase)" +rankprofile[].fef.property[].name "rankingExpression(firstphase).rankingScript" +rankprofile[].fef.property[].value "42 * attribute(outputidx)" +rankprofile[].fef.property[].name "vespa.rank.globalphase" +rankprofile[].fef.property[].value "rankingExpression(use_model)" +rankprofile[].fef.property[].name "vespa.match.feature" +rankprofile[].fef.property[].value "rankingExpression(use_model)" +rankprofile[].fef.property[].name "vespa.feature.rename" +rankprofile[].fef.property[].value "rankingExpression(use_model)" +rankprofile[].fef.property[].name "vespa.feature.rename" +rankprofile[].fef.property[].value "use_model" +rankprofile[].fef.property[].name "vespa.type.attribute.tokens" +rankprofile[].fef.property[].value "tensor(d0[128])" diff --git a/config-model/src/test/derived/globalphase_token_functions/test.sd b/config-model/src/test/derived/globalphase_token_functions/test.sd index 5e849772249..511e09948b4 100644 --- a/config-model/src/test/derived/globalphase_token_functions/test.sd +++ b/config-model/src/test/derived/globalphase_token_functions/test.sd @@ -42,4 +42,23 @@ schema test { } } + rank-profile with-fun { + function use_model() { + expression: attribute(outputidx) + 1.0 + } + global-phase { + expression: use_model + } + } + rank-profile with-fun-mf inherits with-fun { + first-phase { + expression: nativeRank + } + match-features: use_model + } + rank-profile fun-mf-child inherits with-fun-mf { + first-phase { + expression: 42 * attribute(outputidx) + } + } } |