summaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorArne Juul <arnej@yahooinc.com>2024-01-19 11:34:58 +0000
committerArne Juul <arnej@yahooinc.com>2024-01-19 11:34:58 +0000
commitc3985a166aea6d03447b18e09f9071cc280a1c96 (patch)
tree01dd917327f5705387840c682359eb868b57b048 /config-model
parent22e33c6dc241bea6a9cdb51999616ed65d040925 (diff)
fix semantics for empty feature lists
* allow FeatureList to parse empty input and return empty list * if an empty feature list block is specified in a rank-profile, trigger that we no longer get the implicit inheritance
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/main/java/com/yahoo/schema/RankProfile.java30
1 files changed, 9 insertions, 21 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 502b054f84e..9b3e236612a 100644
--- a/config-model/src/main/java/com/yahoo/schema/RankProfile.java
+++ b/config-model/src/main/java/com/yahoo/schema/RankProfile.java
@@ -615,18 +615,6 @@ public class RankProfile implements Cloneable {
.orElse(Set.of());
}
- private void addSummaryFeature(ReferenceNode feature) {
- if (summaryFeatures == null)
- summaryFeatures = new LinkedHashSet<>();
- summaryFeatures.add(feature);
- }
-
- private void addMatchFeature(ReferenceNode feature) {
- if (matchFeatures == null)
- matchFeatures = new LinkedHashSet<>();
- matchFeatures.add(feature);
- }
-
private void addImplicitMatchFeatures(List<FeatureList> list) {
if (hiddenMatchFeatures == null)
hiddenMatchFeatures = new LinkedHashSet<>();
@@ -642,15 +630,19 @@ public class RankProfile implements Cloneable {
/** Adds the content of the given feature list to the internal list of summary features. */
public void addSummaryFeatures(FeatureList features) {
+ if (summaryFeatures == null)
+ summaryFeatures = new LinkedHashSet<>();
for (ReferenceNode feature : features) {
- addSummaryFeature(feature);
+ summaryFeatures.add(feature);
}
}
/** Adds the content of the given feature list to the internal list of match features. */
public void addMatchFeatures(FeatureList features) {
+ if (matchFeatures == null)
+ matchFeatures = new LinkedHashSet<>();
for (ReferenceNode feature : features) {
- addMatchFeature(feature);
+ matchFeatures.add(feature);
}
}
@@ -661,20 +653,16 @@ public class RankProfile implements Cloneable {
.orElse(Set.of());
}
- private void addRankFeature(ReferenceNode feature) {
- if (rankFeatures == null)
- rankFeatures = new LinkedHashSet<>();
- rankFeatures.add(feature);
- }
-
/**
* Adds the content of the given feature list to the internal list of rank features.
*
* @param features The features to add.
*/
public void addRankFeatures(FeatureList features) {
+ if (rankFeatures == null)
+ rankFeatures = new LinkedHashSet<>();
for (ReferenceNode feature : features) {
- addRankFeature(feature);
+ rankFeatures.add(feature);
}
}