aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/test/java/com/yahoo
diff options
context:
space:
mode:
authorGeir Storli <geirst@yahooinc.com>2022-07-12 14:52:33 +0000
committerGeir Storli <geirst@yahooinc.com>2022-07-12 14:52:33 +0000
commitf26d6b65159ffe87cae54038131a7ed89c8bfd79 (patch)
tree2ad6d2a24c48f0da19d6eba88bc65bb99b940935 /config-model/src/test/java/com/yahoo
parent04107d40dc4bc0b83d8cfbf06ad746be45e2ec85 (diff)
Validate that complex fields do not have struct fields with 'indexing: index'.
This is not supported for indexed search clusters, and should be replaced with 'indexing: attribute'.
Diffstat (limited to 'config-model/src/test/java/com/yahoo')
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/application/validation/ComplexFieldsValidatorTestCase.java (renamed from config-model/src/test/java/com/yahoo/vespa/model/application/validation/ComplexAttributeFieldsValidatorTestCase.java)26
1 files changed, 25 insertions, 1 deletions
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/ComplexAttributeFieldsValidatorTestCase.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/ComplexFieldsValidatorTestCase.java
index 85050aa0cf9..11e4ae855a5 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/ComplexAttributeFieldsValidatorTestCase.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/ComplexFieldsValidatorTestCase.java
@@ -22,7 +22,7 @@ import static com.yahoo.config.model.test.TestUtil.joinLines;
/**
* @author geirst
*/
-public class ComplexAttributeFieldsValidatorTestCase {
+public class ComplexFieldsValidatorTestCase {
@SuppressWarnings("deprecation")
@Rule
@@ -78,6 +78,30 @@ public class ComplexAttributeFieldsValidatorTestCase {
}
@Test
+ public void throws_when_complex_fields_have_struct_fields_with_index() throws IOException, SAXException {
+ exceptionRule.expect(IllegalArgumentException.class);
+ exceptionRule.expectMessage("For cluster 'mycluster', schema 'test': " +
+ "The following complex fields have struct fields with 'indexing: index' which is not supported: " +
+ "topics (topics.id, topics.label). Change to 'indexing: attribute' instead");
+ createModelAndValidate(joinLines(
+ "schema test {",
+ "document test {",
+ "struct topic {",
+ " field id type string {}",
+ " field label type string {}",
+ " field desc type string {}",
+ "}",
+ "field topics type array<topic> {",
+ " indexing: summary",
+ " struct-field id { indexing: index }",
+ " struct-field label { indexing: index | attribute }",
+ " struct-field desc { indexing: attribute }",
+ "}",
+ "}",
+ "}"));
+ }
+
+ @Test
public void validation_passes_when_only_supported_struct_field_attributes_are_used() throws IOException, SAXException {
createModelAndValidate(joinLines("search test {",
" document test {",