summaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2021-09-07 21:49:17 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2021-09-07 21:49:17 +0200
commite0dd46186f2dead2fdc5666ee8063b3e1af33f69 (patch)
tree7c5f90608dd1ba17d362741277bf85185c088e69 /config-model
parentfa5f599c6ce501a6af11d527292a5f7c982fa1c3 (diff)
Use fully qualified rank-profile names
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/RankProfile.java11
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/RankProfileTestCase.java4
2 files changed, 10 insertions, 5 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 4c4cc3b524f..17b5953b824 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/RankProfile.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/RankProfile.java
@@ -217,17 +217,22 @@ public class RankProfile implements Cloneable {
}
} else {
List<String> children = new ArrayList<>();
- children.add(getName());
+ children.add(createFullyQualifiedName());
verifyNoInheritanceCycle(children, inherited);
}
}
return inherited;
}
+ private String createFullyQualifiedName() {
+ return (search != null)
+ ? (search.getName() + "." + getName())
+ : getName();
+ }
private void verifyNoInheritanceCycle(List<String> children, RankProfile parent) {
- children.add(parent.getName());
+ children.add(parent.createFullyQualifiedName());
String root = children.get(0);
- if (root.equals(parent.getName())) {
+ if (root.equals(parent.createFullyQualifiedName())) {
throw new IllegalArgumentException("There is a cycle in the inheritance for rank-profile '" + root + "' = " + children);
}
if (parent.getInherited() != null) {
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/RankProfileTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/RankProfileTestCase.java
index c58a539abf1..6330a7bfc72 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/RankProfileTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/RankProfileTestCase.java
@@ -92,7 +92,7 @@ public class RankProfileTestCase extends SchemaTestCase {
builder.build(true);
fail();
} catch (IllegalArgumentException e) {
- assertEquals("There is a cycle in the inheritance for rank-profile 'self' = [self, self]", e.getMessage());
+ assertEquals("There is a cycle in the inheritance for rank-profile 'test.self' = [test.self, test.self]", e.getMessage());
}
}
@@ -111,7 +111,7 @@ public class RankProfileTestCase extends SchemaTestCase {
builder.build(true);
fail();
} catch (IllegalArgumentException e) {
- assertEquals("There is a cycle in the inheritance for rank-profile 'c' = [c, a, b, c]", e.getMessage());
+ assertEquals("There is a cycle in the inheritance for rank-profile 'test.c' = [test.c, test.a, test.b, test.c]", e.getMessage());
}
}