aboutsummaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorArne Juul <arnej@vespa.ai>2023-10-26 12:52:42 +0000
committerArne Juul <arnej@vespa.ai>2023-10-26 12:52:58 +0000
commit6093738f514ef7bcdb6d5a192498245fe8b76361 (patch)
tree811527da87cf4696ea361927ba87343bd0d18d03 /config-model
parentbce3b8e926bf9da880172acbe1ba4b12d5e026d6 (diff)
keep the implicit (hidden) match features in a separate set in RankProfile
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/main/java/com/yahoo/schema/RankProfile.java14
-rw-r--r--config-model/src/main/java/com/yahoo/schema/derived/RawRankProfile.java7
2 files changed, 9 insertions, 12 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 0cfcddc6c57..1ff85c9c89f 100644
--- a/config-model/src/main/java/com/yahoo/schema/RankProfile.java
+++ b/config-model/src/main/java/com/yahoo/schema/RankProfile.java
@@ -111,7 +111,7 @@ public class RankProfile implements Cloneable {
private String inheritedSummaryFeaturesProfileName;
private Set<ReferenceNode> matchFeatures;
- private Set<String> hiddenMatchFeatures;
+ private Set<ReferenceNode> hiddenMatchFeatures;
private String inheritedMatchFeaturesProfileName;
private Set<ReferenceNode> rankFeatures;
@@ -609,7 +609,7 @@ public class RankProfile implements Cloneable {
.orElse(Set.of());
}
- public Set<String> getHiddenMatchFeatures() {
+ public Set<ReferenceNode> getHiddenMatchFeatures() {
if (hiddenMatchFeatures != null) return Collections.unmodifiableSet(hiddenMatchFeatures);
return uniquelyInherited(p -> p.getHiddenMatchFeatures(), f -> ! f.isEmpty(), "hidden match features")
.orElse(Set.of());
@@ -628,17 +628,13 @@ public class RankProfile implements Cloneable {
}
private void addImplicitMatchFeatures(List<FeatureList> list) {
- if (matchFeatures == null) {
- var inherited = getMatchFeatures();
- matchFeatures = new LinkedHashSet<>(inherited);
- }
if (hiddenMatchFeatures == null)
hiddenMatchFeatures = new LinkedHashSet<>();
+ var current = getMatchFeatures();
for (var features : list) {
for (ReferenceNode feature : features) {
- if (! matchFeatures.contains(feature)) {
- matchFeatures.add(feature);
- hiddenMatchFeatures.add(feature.toString());
+ if (! current.contains(feature)) {
+ hiddenMatchFeatures.add(feature);
}
}
}
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 eb9f7d44c91..68fa0fe6de9 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
@@ -149,7 +149,7 @@ public class RawRankProfile implements RankProfilesConfig.Producer {
private final Map<String, FieldRankSettings> fieldRankSettings = new java.util.LinkedHashMap<>();
private final Set<ReferenceNode> summaryFeatures;
private final Set<ReferenceNode> matchFeatures;
- private final Collection<String> hiddenMatchFeatures;
+ private final Set<ReferenceNode> hiddenMatchFeatures;
private final Set<ReferenceNode> rankFeatures;
private final Map<String, String> featureRenames = new java.util.LinkedHashMap<>();
private final List<RankProfile.RankProperty> rankProperties;
@@ -203,6 +203,7 @@ public class RawRankProfile implements RankProfilesConfig.Producer {
summaryFeatures = new LinkedHashSet<>(compiled.getSummaryFeatures());
matchFeatures = new LinkedHashSet<>(compiled.getMatchFeatures());
hiddenMatchFeatures = compiled.getHiddenMatchFeatures();
+ matchFeatures.addAll(hiddenMatchFeatures);
rankFeatures = compiled.getRankFeatures();
rerankCount = compiled.getRerankCount();
globalPhaseRerankCount = compiled.getGlobalPhaseRerankCount();
@@ -429,8 +430,8 @@ public class RawRankProfile implements RankProfilesConfig.Producer {
for (ReferenceNode feature : matchFeatures) {
properties.add(new Pair<>("vespa.match.feature", feature.toString()));
}
- for (String feature : hiddenMatchFeatures) {
- properties.add(new Pair<>("vespa.hidden.matchfeature", feature));
+ for (ReferenceNode feature : hiddenMatchFeatures) {
+ properties.add(new Pair<>("vespa.hidden.matchfeature", feature.toString()));
}
for (ReferenceNode feature : rankFeatures) {
properties.add(new Pair<>("vespa.dump.feature", feature.toString()));