summaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com/yahoo/searchdefinition/RankProfile.java
diff options
context:
space:
mode:
Diffstat (limited to 'config-model/src/main/java/com/yahoo/searchdefinition/RankProfile.java')
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/RankProfile.java19
1 files changed, 10 insertions, 9 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 5b842b002bd..53e9cfd5601 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/RankProfile.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/RankProfile.java
@@ -205,22 +205,25 @@ public class RankProfile implements Cloneable {
* The profile must belong to this schema (directly or by inheritance).
*/
public void inherit(String inheritedName) {
- inherited = null;
inheritedNames.add(inheritedName);
}
/** Returns the names of the profiles this inherits, if any. */
- public List<String> inheritedNames() { return Collections.unmodifiableList(inheritedNames); }
+ public List<String> inheritedNames() { return inheritedNames; }
/** Returns the rank profiles inherited by this. */
private List<RankProfile> inherited() {
if (inheritedNames.isEmpty()) return List.of();
if (inherited != null) return inherited;
- inherited = resolveInheritedProfiles(schema);
- List<String> children = new ArrayList<>();
- children.add(createFullyQualifiedName());
- inherited.forEach(profile -> verifyNoInheritanceCycle(children, profile));
+ for (String inheritedName : inheritedNames) {
+ inherited = (schema() != null) ? resolveInheritedProfiles(schema)
+ : List.of(rankProfileRegistry.getGlobal(inheritedName));
+
+ List<String> children = new ArrayList<>();
+ children.add(createFullyQualifiedName());
+ inherited.forEach(profile -> verifyNoInheritanceCycle(children, profile));
+ }
return inherited;
}
@@ -242,9 +245,7 @@ public class RankProfile implements Cloneable {
private List<RankProfile> resolveInheritedProfiles(ImmutableSchema schema) {
List<RankProfile> inherited = new ArrayList<>();
for (String inheritedName : inheritedNames) {
- RankProfile inheritedProfile = schema == null
- ? rankProfileRegistry.getGlobal(inheritedName)
- : resolveInheritedProfile(schema, inheritedName);
+ RankProfile inheritedProfile = resolveInheritedProfile(schema, inheritedName);
if (inheritedProfile == null)
throw new IllegalArgumentException("rank-profile '" + name() + "' inherits '" + inheritedName +
"', but this is not found in " +