diff options
author | Jon Bratseth <bratseth@gmail.com> | 2021-10-19 14:34:54 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2021-10-19 14:34:54 +0200 |
commit | e4651cd18ffa22ceec76ea982be8a9fbe171b4b1 (patch) | |
tree | 20cd8e3158895b1fc72e90061ad776c986020803 /config-model/src/test/java/com/yahoo/searchdefinition | |
parent | fb81412a6718ce2419ceee89a09c6705a4578487 (diff) |
Use 'schema' not 'search' in messages
Diffstat (limited to 'config-model/src/test/java/com/yahoo/searchdefinition')
23 files changed, 84 insertions, 78 deletions
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/NameFieldCheckTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/NameFieldCheckTestCase.java index 557df74e700..46da671d860 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/NameFieldCheckTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/NameFieldCheckTestCase.java @@ -52,7 +52,8 @@ public class NameFieldCheckTestCase extends AbstractSchemaTestCase { "}"); fail("Should throw exception."); } catch (Exception e) { - assertEquals("For search 'duplicatenamesinsearch', field 'grpphotoids64': Incompatible types. Expected Array<long> for index field 'grpphotoids64', got string.", e.getMessage()); + assertEquals("For schema 'duplicatenamesinsearch', field 'grpphotoids64': " + + "Incompatible types. Expected Array<long> for index field 'grpphotoids64', got string.", e.getMessage()); } } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/PredicateDataTypeTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/PredicateDataTypeTestCase.java index e1b0edb0d0c..e5afb481b80 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/PredicateDataTypeTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/PredicateDataTypeTestCase.java @@ -136,7 +136,7 @@ public class PredicateDataTypeTestCase { String sd = searchSd(predicateFieldSd("indexing: summary | index | attribute\nindex { arity: 2 }")); exception.expect(IllegalArgumentException.class); - exception.expectMessage("For search 'p', field 'pf': Use 'attribute' instead of 'index'. This will require a refeed if you have upgraded."); + exception.expectMessage("For schema 'p', field 'pf': Use 'attribute' instead of 'index'. This will require a refeed if you have upgraded."); SearchBuilder.createFromString(sd); } @@ -145,7 +145,7 @@ public class PredicateDataTypeTestCase { String sd = searchSd(predicateFieldSd("indexing: summary | index \nindex { arity: 2 }")); exception.expect(IllegalArgumentException.class); - exception.expectMessage("For search 'p', field 'pf': Use 'attribute' instead of 'index'. This will require a refeed if you have upgraded."); + exception.expectMessage("For schema 'p', field 'pf': Use 'attribute' instead of 'index'. This will require a refeed if you have upgraded."); SearchBuilder.createFromString(sd); } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/SchemaTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/SchemaTestCase.java index 5801f25f0af..764883feea9 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/SchemaTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/SchemaTestCase.java @@ -98,6 +98,7 @@ public class SchemaTestCase { " document-summary parent_summary {" + " summary pf1 type string {}" + " }" + + //" import field parentschema_ref.name as parent_name {}" + "}"); String childLines = joinLines( "schema child inherits parent {" + diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/StructTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/StructTestCase.java index 73c8915b5a0..b86225110df 100755 --- a/config-model/src/test/java/com/yahoo/searchdefinition/StructTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/StructTestCase.java @@ -37,7 +37,7 @@ public class StructTestCase extends AbstractSchemaTestCase { try { DocumenttypesConfig.Builder dt = Deriver.getDocumentTypesConfig("src/test/examples/structanddocumentwithsamenames.sd"); } catch (Exception e) { - fail("Should not have thrown exception " + e.toString()); + fail("Should not have thrown exception " + e); } } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/SummaryTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/SummaryTestCase.java index 52e155fc9a5..e57dcf38fed 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/SummaryTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/SummaryTestCase.java @@ -27,7 +27,7 @@ public class SummaryTestCase { @Test public void testMemorySummary() throws ParseException { String sd = joinLines( - "search memorysummary {", + "schema memorysummary {", " document memorysummary {", " field inmemory type string {", " indexing: attribute | summary", @@ -45,7 +45,7 @@ public class SummaryTestCase { @Test public void testDiskSummary() throws ParseException { String sd = joinLines( - "search disksummary {", + "schema disksummary {", " document-summary foobar {", " summary foo1 type string { source: inmemory }", " summary foo2 type string { source: ondisk }", @@ -72,7 +72,7 @@ public class SummaryTestCase { @Test public void testDiskSummaryExplicit() throws ParseException { String sd = joinLines( - "search disksummary {", + "schema disksummary {", " document disksummary {", " field inmemory type string {", " indexing: attribute | summary", @@ -95,7 +95,7 @@ public class SummaryTestCase { @Test public void testStructMemorySummary() throws ParseException { String sd = joinLines( - "search structmemorysummary {", + "schema structmemorysummary {", " document structmemorysummary {", " struct elem {", " field name type string {}", @@ -126,7 +126,7 @@ public class SummaryTestCase { @Test public void testInheritance() throws Exception { String sd = joinLines( - "search music {", + "schema music {", " document music {", " field title type string {", " indexing: summary | attribute | index", @@ -185,7 +185,7 @@ public class SummaryTestCase { @Test public void testRedeclaringInheritedFieldFails() throws Exception { String sd = joinLines( - "search music {", + "schema music {", " document music {", " field title type string {", " indexing: summary | attribute | index", @@ -210,7 +210,7 @@ public class SummaryTestCase { SearchBuilder.createFromString(sd, logger); fail("Expected exception"); } catch (IllegalArgumentException e) { - assertEquals("For search 'music', summary class 'title2', summary field 'title': Can not use " + + assertEquals("For schema 'music', summary class 'title2', summary field 'title': Can not use " + "source 'title_short' for this summary field, an equally named field in summary class 'title' " + "uses a different source: 'title'.", e.getMessage()); } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/AdjustPositionSummaryFieldsTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/AdjustPositionSummaryFieldsTestCase.java index 21fab6ee01c..51cd05f7178 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/AdjustPositionSummaryFieldsTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/AdjustPositionSummaryFieldsTestCase.java @@ -92,8 +92,7 @@ public class AdjustPositionSummaryFieldsTestCase { @Test public void test_pos_summary_no_attr() { exceptionRule.expect(IllegalArgumentException.class); - exceptionRule.expectMessage("For search 'child', field 'my_pos': " - + "No position attribute 'pos_zcurve'"); + exceptionRule.expectMessage("For schema 'child', field 'my_pos': No position attribute 'pos_zcurve'"); SearchModel model = new SearchModel(false, false, false); model.addSummaryField("my_pos", PositionDataType.INSTANCE, null, "pos"); model.resolve(); @@ -102,8 +101,7 @@ public class AdjustPositionSummaryFieldsTestCase { @Test public void test_pos_summary_bad_attr() { exceptionRule.expect(IllegalArgumentException.class); - exceptionRule.expectMessage("For search 'child', field 'my_pos': " - + "No position attribute 'pos_zcurve'"); + exceptionRule.expectMessage("For schema 'child', field 'my_pos': No position attribute 'pos_zcurve'"); SearchModel model = new SearchModel(false, false, true); model.addSummaryField("my_pos", PositionDataType.INSTANCE, null, "pos"); model.resolve(); @@ -112,7 +110,7 @@ public class AdjustPositionSummaryFieldsTestCase { @Test public void test_imported_pos_summary_no_attr() { exceptionRule.expect(IllegalArgumentException.class); - exceptionRule.expectMessage("For search 'child', import field 'my_pos_zcurve': " + exceptionRule.expectMessage("For schema 'child', import field 'my_pos_zcurve': " + "Field 'pos_zcurve' via reference field 'ref': Not found"); SearchModel model = new SearchModel(true, false, false); model.addSummaryField("my_pos", PositionDataType.INSTANCE, null, null); @@ -122,7 +120,7 @@ public class AdjustPositionSummaryFieldsTestCase { @Test public void test_imported_pos_summary_bad_attr() { exceptionRule.expect(IllegalArgumentException.class); - exceptionRule.expectMessage("For search 'child', field 'my_pos': " + exceptionRule.expectMessage("For schema 'child', field 'my_pos': " + "No position attribute 'my_pos_zcurve'"); SearchModel model = new SearchModel(true, false, true); model.addSummaryField("my_pos", PositionDataType.INSTANCE, null, null); @@ -132,7 +130,7 @@ public class AdjustPositionSummaryFieldsTestCase { @Test public void test_my_pos_position_summary_bad_datatype() { exceptionRule.expect(IllegalArgumentException.class); - exceptionRule.expectMessage("For search 'child', field 'my_pos.position': " + exceptionRule.expectMessage("For schema 'child', field 'my_pos.position': " + "exists with type 'datatype string (code: 2)', should be of type 'datatype Array<string> (code: -1486737430)"); SearchModel model = new SearchModel(); model.addSummaryField("my_pos", PositionDataType.INSTANCE, null, null); @@ -143,7 +141,7 @@ public class AdjustPositionSummaryFieldsTestCase { @Test public void test_my_pos_position_summary_bad_transform() { exceptionRule.expect(IllegalArgumentException.class); - exceptionRule.expectMessage("For search 'child', field 'my_pos.position': " + exceptionRule.expectMessage("For schema 'child', field 'my_pos.position': " + "has summary transform 'none', should have transform 'positions'"); SearchModel model = new SearchModel(); model.addSummaryField("my_pos", PositionDataType.INSTANCE, null, null); @@ -154,7 +152,7 @@ public class AdjustPositionSummaryFieldsTestCase { @Test public void test_my_pos_position_summary_bad_source() { exceptionRule.expect(IllegalArgumentException.class); - exceptionRule.expectMessage("For search 'child', field 'my_pos.position': " + exceptionRule.expectMessage("For schema 'child', field 'my_pos.position': " + "has source '[source field 'pos']', should have source 'source field 'my_pos_zcurve''"); SearchModel model = new SearchModel(); model.addSummaryField("my_pos", PositionDataType.INSTANCE, null, null); diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/BoolAttributeValidatorTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/BoolAttributeValidatorTestCase.java index a50af793bc4..fbfb46be558 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/BoolAttributeValidatorTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/BoolAttributeValidatorTestCase.java @@ -21,7 +21,7 @@ public class BoolAttributeValidatorTestCase { fail("Expected exception"); } catch (IllegalArgumentException e) { - assertEquals("For search 'test', field 'b': Only single value bool attribute fields are supported", + assertEquals("For schema 'test', field 'b': Only single value bool attribute fields are supported", e.getMessage()); } } @@ -33,13 +33,14 @@ public class BoolAttributeValidatorTestCase { fail("Expected exception"); } catch (IllegalArgumentException e) { - assertEquals("For search 'test', field 'b': Only single value bool attribute fields are supported", + assertEquals("For schema 'test', field 'b': Only single value bool attribute fields are supported", e.getMessage()); } } private String getSd(String field) { - return joinLines("search test {", + return joinLines( + "schema test {", " document test {", " " + field, " }", diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/DictionaryTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/DictionaryTestCase.java index 643d46e2d48..20ff10cb48e 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/DictionaryTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/DictionaryTestCase.java @@ -144,7 +144,7 @@ public class DictionaryTestCase { try { verifyStringDictionaryControl(Dictionary.Type.HASH, Case.UNCASED, Case.UNCASED, "dictionary:hash"); } catch (IllegalArgumentException e) { - assertEquals("For search 'test', field 'n1': hash dictionary require cased match", e.getMessage()); + assertEquals("For schema 'test', field 'n1': hash dictionary require cased match", e.getMessage()); } } @Test @@ -152,7 +152,7 @@ public class DictionaryTestCase { try { verifyStringDictionaryControl(Dictionary.Type.HASH, Case.UNCASED, Case.UNCASED, "dictionary { hash\nuncased\n}"); } catch (IllegalArgumentException e) { - assertEquals("For search 'test', field 'n1': hash dictionary require cased match", e.getMessage()); + assertEquals("For schema 'test', field 'n1': hash dictionary require cased match", e.getMessage()); } } @Test @@ -165,7 +165,7 @@ public class DictionaryTestCase { verifyStringDictionaryControl(Dictionary.Type.HASH, Case.CASED, Case.CASED, "dictionary { hash\ncased\n}"); fail(); } catch (IllegalArgumentException e) { - assertEquals("For search 'test', field 'n1': Dictionary casing 'CASED' does not match field match casing 'UNCASED'", e.getMessage()); + assertEquals("For schema 'test', field 'n1': Dictionary casing 'CASED' does not match field match casing 'UNCASED'", e.getMessage()); } } @Test @@ -181,13 +181,13 @@ public class DictionaryTestCase { try { verifyStringDictionaryControl(Dictionary.Type.BTREE_AND_HASH, Case.CASED, Case.CASED, "dictionary { btree\nhash\ncased\n}"); } catch (IllegalArgumentException e) { - assertEquals("For search 'test', field 'n1': Dictionary casing 'CASED' does not match field match casing 'UNCASED'", e.getMessage()); + assertEquals("For schema 'test', field 'n1': Dictionary casing 'CASED' does not match field match casing 'UNCASED'", e.getMessage()); } } @Test public void testNonNumericFieldsFailsDictionaryControl() throws ParseException { String def = TestUtil.joinLines( - "search test {", + "schema test {", " document test {", " field n1 type bool {", " indexing: summary | attribute", @@ -199,13 +199,13 @@ public class DictionaryTestCase { SearchBuilder sb = SearchBuilder.createFromString(def); fail("Controlling dictionary for non-numeric fields are not yet supported."); } catch (IllegalArgumentException e) { - assertEquals("For search 'test', field 'n1': You can only specify 'dictionary:' for numeric or string fields", e.getMessage()); + assertEquals("For schema 'test', field 'n1': You can only specify 'dictionary:' for numeric or string fields", e.getMessage()); } } @Test public void testNonFastSearchNumericFieldsFailsDictionaryControl() throws ParseException { String def = TestUtil.joinLines( - "search test {", + "schema test {", " document test {", " field n1 type int {", " indexing: summary | attribute", @@ -217,14 +217,14 @@ public class DictionaryTestCase { SearchBuilder sb = SearchBuilder.createFromString(def); fail("Controlling dictionary for non-fast-search fields are not allowed."); } catch (IllegalArgumentException e) { - assertEquals("For search 'test', field 'n1': You must specify 'attribute:fast-search' to allow dictionary control", e.getMessage()); + assertEquals("For schema 'test', field 'n1': You must specify 'attribute:fast-search' to allow dictionary control", e.getMessage()); } } @Test public void testCasingForNonFastSearch() throws ParseException { String def = TestUtil.joinLines( - "search test {", + "schema test {", " document test {", " field s1 type string {", " indexing: attribute | summary", diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/FastAccessValidatorTest.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/FastAccessValidatorTest.java index c889a8ccd34..0a9807e0746 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/FastAccessValidatorTest.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/FastAccessValidatorTest.java @@ -22,14 +22,14 @@ public class FastAccessValidatorTest { SearchBuilder builder = new SearchBuilder(new RankProfileRegistry()); builder.importString( TestUtil.joinLines( - "search parent {", + "schema parent {", " document parent {", " field int_field type int { indexing: attribute }", " }", "}")); builder.importString( TestUtil.joinLines( - "search test {", + "schema test {", " document test { ", " field int_attribute type int { ", " indexing: attribute ", @@ -51,7 +51,7 @@ public class FastAccessValidatorTest { "}")); exceptionRule.expect(IllegalArgumentException.class); exceptionRule.expectMessage( - "For search 'test': The following attributes have a type that is incompatible " + + "For schema 'test': The following attributes have a type that is incompatible " + "with fast-access: predicate_attribute, tensor_attribute, reference_attribute. " + "Predicate, tensor and reference attributes are incompatible with fast-access."); builder.build(); diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/ImportedFieldsResolverTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/ImportedFieldsResolverTestCase.java index e803d116235..2520b2e8ac3 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/ImportedFieldsResolverTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/ImportedFieldsResolverTestCase.java @@ -60,7 +60,7 @@ public class ImportedFieldsResolverTestCase { @Test public void resolver_fails_if_document_reference_is_not_found() { exceptionRule.expect(IllegalArgumentException.class); - exceptionRule.expectMessage("For search 'child', import field 'my_attribute_field': " + exceptionRule.expectMessage("For schema 'child', import field 'my_attribute_field': " + "Reference field 'not_ref' not found"); new SearchModel().addImportedField("my_attribute_field", "not_ref", "budget").resolve(); } @@ -68,7 +68,7 @@ public class ImportedFieldsResolverTestCase { @Test public void resolver_fails_if_referenced_field_is_not_found() { exceptionRule.expect(IllegalArgumentException.class); - exceptionRule.expectMessage("For search 'child', import field 'my_attribute_field': " + exceptionRule.expectMessage("For schema 'child', import field 'my_attribute_field': " + "Field 'not_existing' via reference field 'ref': Not found"); new SearchModel().addImportedField("my_attribute_field", "ref", "not_existing").resolve(); } @@ -76,7 +76,7 @@ public class ImportedFieldsResolverTestCase { @Test public void resolver_fails_if_imported_field_is_not_an_attribute() { exceptionRule.expect(IllegalArgumentException.class); - exceptionRule.expectMessage("For search 'child', import field 'my_not_attribute': " + exceptionRule.expectMessage("For schema 'child', import field 'my_not_attribute': " + "Field 'not_attribute' via reference field 'ref': Is not an attribute field. Only attribute fields supported"); new SearchModel().addImportedField("my_not_attribute", "ref", "not_attribute").resolve(); } @@ -85,7 +85,7 @@ public class ImportedFieldsResolverTestCase { public void resolver_fails_if_imported_field_is_indexing() { exceptionRule.expect(IllegalArgumentException.class); exceptionRule.expectMessage( - "For search 'child', import field 'my_attribute_and_index': " + + "For schema 'child', import field 'my_attribute_and_index': " + "Field 'attribute_and_index' via reference field 'ref': Is an index field. Not supported"); new SearchModel() .addImportedField("my_attribute_and_index", "ref", "attribute_and_index") @@ -96,7 +96,7 @@ public class ImportedFieldsResolverTestCase { public void resolver_fails_if_imported_field_is_of_type_predicate() { exceptionRule.expect(IllegalArgumentException.class); exceptionRule.expectMessage( - "For search 'child', import field 'my_predicate_field': " + + "For schema 'child', import field 'my_predicate_field': " + "Field 'predicate_field' via reference field 'ref': Is of type 'predicate'. Not supported"); new SearchModel().addImportedField("my_predicate_field", "ref", "predicate_field").resolve(); } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/ImportedFieldsTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/ImportedFieldsTestCase.java index dbf099c61f0..37b7ab0955c 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/ImportedFieldsTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/ImportedFieldsTestCase.java @@ -68,12 +68,14 @@ public class ImportedFieldsTestCase { private static Schema buildAdSearch(String sdContent) throws ParseException { SearchBuilder builder = new SearchBuilder(); - builder.importString(joinLines("search campaign {", + builder.importString(joinLines( + "schema campaign {", " document campaign {", " field budget type int { indexing: attribute }", " }", "}")); - builder.importString(joinLines("search person {", + builder.importString(joinLines( + "schema person {", " document person {", " field name type string { indexing: attribute }", " }", @@ -126,35 +128,35 @@ public class ImportedFieldsTestCase { @Test public void check_illegal_struct_import_missing_array_of_struct_attributes() throws ParseException { exception.expect(IllegalArgumentException.class); - exception.expectMessage("For search 'child', import field 'my_elem_array': Field 'elem_array' via reference field 'parent_ref': Is not a struct containing an attribute field."); + exception.expectMessage("For schema 'child', import field 'my_elem_array': Field 'elem_array' via reference field 'parent_ref': Is not a struct containing an attribute field."); checkStructImport(new ParentStructSdBuilder().elem_array_name_attr(false).elem_array_weight_attr(false)); } @Test public void check_illegal_struct_import_missing_map_of_struct_key_attribute() throws ParseException { exception.expect(IllegalArgumentException.class); - exception.expectMessage("For search 'child', import field 'my_elem_map' (nested to 'my_elem_map.key'): Field 'elem_map.key' via reference field 'parent_ref': Is not an attribute field. Only attribute fields supported"); + exception.expectMessage("For schema 'child', import field 'my_elem_map' (nested to 'my_elem_map.key'): Field 'elem_map.key' via reference field 'parent_ref': Is not an attribute field. Only attribute fields supported"); checkStructImport(new ParentStructSdBuilder().elem_map_key_attr(false)); } @Test public void check_illegal_struct_import_missing_map_of_struct_value_attributes() throws ParseException { exception.expect(IllegalArgumentException.class); - exception.expectMessage("For search 'child', import field 'my_elem_map' (nested to 'my_elem_map.value'): Field 'elem_map.value' via reference field 'parent_ref': Is not a struct containing an attribute field."); + exception.expectMessage("For schema 'child', import field 'my_elem_map' (nested to 'my_elem_map.value'): Field 'elem_map.value' via reference field 'parent_ref': Is not a struct containing an attribute field."); checkStructImport(new ParentStructSdBuilder().elem_map_value_name_attr(false).elem_map_value_weight_attr(false)); } @Test public void check_illegal_struct_import_missing_map_of_primitive_key_attribute() throws ParseException { exception.expect(IllegalArgumentException.class); - exception.expectMessage("For search 'child', import field 'my_str_int_map' (nested to 'my_str_int_map.key'): Field 'str_int_map.key' via reference field 'parent_ref': Is not an attribute field. Only attribute fields supported"); + exception.expectMessage("For schema 'child', import field 'my_str_int_map' (nested to 'my_str_int_map.key'): Field 'str_int_map.key' via reference field 'parent_ref': Is not an attribute field. Only attribute fields supported"); checkStructImport(new ParentStructSdBuilder().str_int_map_key_attr(false)); } @Test public void check_illegal_struct_import_missing_map_of_primitive_value_attribute() throws ParseException { exception.expect(IllegalArgumentException.class); - exception.expectMessage("For search 'child', import field 'my_str_int_map' (nested to 'my_str_int_map.value'): Field 'str_int_map.value' via reference field 'parent_ref': Is not an attribute field. Only attribute fields supported"); + exception.expectMessage("For schema 'child', import field 'my_str_int_map' (nested to 'my_str_int_map.value'): Field 'str_int_map.value' via reference field 'parent_ref': Is not an attribute field. Only attribute fields supported"); checkStructImport(new ParentStructSdBuilder().str_int_map_value_attr(false)); } @@ -417,7 +419,7 @@ public class ImportedFieldsTestCase { @Test public void check_pos_import_after_pos_zcurve_import() throws ParseException { exception.expect(IllegalArgumentException.class); - exception.expectMessage("For search 'child', import field 'my_pos_zcurve': Field 'pos_zcurve' via reference field 'parent_ref': Field already imported"); + exception.expectMessage("For schema 'child', import field 'my_pos_zcurve': Field 'pos_zcurve' via reference field 'parent_ref': Field already imported"); checkPosImport(new ParentPosSdBuilder(), new ChildPosSdBuilder().import_pos_zcurve_before(true)); } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/IndexingInputsTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/IndexingInputsTestCase.java index bb935fb8a90..725b1b17ff0 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/IndexingInputsTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/IndexingInputsTestCase.java @@ -16,7 +16,7 @@ public class IndexingInputsTestCase { @Test public void requireThatExtraFieldInputExtraFieldThrows() throws IOException, ParseException { assertBuildFails("src/test/examples/indexing_extra_field_input_extra_field.sd", - "For search 'indexing_extra_field_input_extra_field', field 'bar': Indexing script refers " + + "For schema 'indexing_extra_field_input_extra_field', field 'bar': Indexing script refers " + "to field 'bar' which does not exist in document type " + "'indexing_extra_field_input_extra_field', and is not a mutable attribute."); } @@ -24,21 +24,22 @@ public class IndexingInputsTestCase { @Test public void requireThatExtraFieldInputImplicitThrows() throws IOException, ParseException { assertBuildFails("src/test/examples/indexing_extra_field_input_implicit.sd", - "For search 'indexing_extra_field_input_implicit', field 'foo': Indexing script refers to " + + "For schema 'indexing_extra_field_input_implicit', field 'foo': Indexing script refers to " + "field 'foo' which does not exist in document type 'indexing_extra_field_input_implicit', and is not a mutable attribute."); } @Test public void requireThatExtraFieldInputNullThrows() throws IOException, ParseException { assertBuildFails("src/test/examples/indexing_extra_field_input_null.sd", - "For search 'indexing_extra_field_input_null', field 'foo': Indexing script refers to field " + + "For schema 'indexing_extra_field_input_null', field 'foo': Indexing script refers to field " + "'foo' which does not exist in document type 'indexing_extra_field_input_null', and is not a mutable attribute."); } @Test public void requireThatExtraFieldInputSelfThrows() throws IOException, ParseException { assertBuildFails("src/test/examples/indexing_extra_field_input_self.sd", - "For search 'indexing_extra_field_input_self', field 'foo': Indexing script refers to field " + + "For schema 'indexing_extra_field_input_self', field 'foo': Indexing script refers to field " + "'foo' which does not exist in document type 'indexing_extra_field_input_self', and is not a mutable attribute."); } + } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/IndexingOutputsTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/IndexingOutputsTestCase.java index 4d765127276..5ea4b37991a 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/IndexingOutputsTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/IndexingOutputsTestCase.java @@ -17,14 +17,14 @@ public class IndexingOutputsTestCase { @Test public void requireThatOutputOtherFieldThrows() throws IOException, ParseException { assertBuildFails("src/test/examples/indexing_output_other_field.sd", - "For search 'indexing_output_other_field', field 'foo': Indexing expression 'index bar' " + + "For schema 'indexing_output_other_field', field 'foo': Indexing expression 'index bar' " + "attempts to write to a field other than 'foo'."); } @Test public void requireThatOutputConflictThrows() throws IOException, ParseException { assertBuildFails("src/test/examples/indexing_output_conflict.sd", - "For search 'indexing_output_confict', field 'bar': For expression 'index bar': Attempting " + + "For schema 'indexing_output_confict', field 'bar': For expression 'index bar': Attempting " + "to assign conflicting values to field 'bar'."); } } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/IndexingValidationTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/IndexingValidationTestCase.java index 15f2b179470..9f8e810f1f8 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/IndexingValidationTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/IndexingValidationTestCase.java @@ -20,42 +20,42 @@ public class IndexingValidationTestCase extends AbstractExportingTestCase { @Test public void testAttributeChanged() throws IOException, ParseException { assertBuildFails("src/test/examples/indexing_attribute_changed.sd", - "For search 'indexing_attribute_changed', field 'foo': For expression 'attribute foo': " + + "For schema 'indexing_attribute_changed', field 'foo': For expression 'attribute foo': " + "Attempting to assign conflicting values to field 'foo'."); } @Test public void testAttributeOther() throws IOException, ParseException { assertBuildFails("src/test/examples/indexing_attribute_other.sd", - "For search 'indexing_attribute_other', field 'foo': Indexing expression 'attribute bar' " + + "For schema 'indexing_attribute_other', field 'foo': Indexing expression 'attribute bar' " + "attempts to write to a field other than 'foo'."); } @Test public void testIndexChanged() throws IOException, ParseException { assertBuildFails("src/test/examples/indexing_index_changed.sd", - "For search 'indexing_index_changed', field 'foo': For expression 'index foo': " + + "For schema 'indexing_index_changed', field 'foo': For expression 'index foo': " + "Attempting to assign conflicting values to field 'foo'."); } @Test public void testIndexOther() throws IOException, ParseException { assertBuildFails("src/test/examples/indexing_index_other.sd", - "For search 'indexing_index_other', field 'foo': Indexing expression 'index bar' " + + "For schema 'indexing_index_other', field 'foo': Indexing expression 'index bar' " + "attempts to write to a field other than 'foo'."); } @Test public void testSummaryChanged() throws IOException, ParseException { assertBuildFails("src/test/examples/indexing_summary_changed.sd", - "For search 'indexing_summary_fail', field 'foo': For expression 'summary foo': Attempting " + + "For schema 'indexing_summary_fail', field 'foo': For expression 'summary foo': Attempting " + "to assign conflicting values to field 'foo'."); } @Test public void testSummaryOther() throws IOException, ParseException { assertBuildFails("src/test/examples/indexing_summary_other.sd", - "For search 'indexing_summary_other', field 'foo': Indexing expression 'summary bar' " + + "For schema 'indexing_summary_other', field 'foo': Indexing expression 'summary bar' " + "attempts to write to a field other than 'foo'."); } @@ -70,7 +70,7 @@ public class IndexingValidationTestCase extends AbstractExportingTestCase { @Test public void requireThatMultilineOutputConflictThrows() throws IOException, ParseException { assertBuildFails("src/test/examples/indexing_multiline_output_conflict.sd", - "For search 'indexing_multiline_output_confict', field 'cox': For expression 'index cox': " + + "For schema 'indexing_multiline_output_confict', field 'cox': For expression 'index cox': " + "Attempting to assign conflicting values to field 'cox'."); } } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/IndexingValuesTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/IndexingValuesTestCase.java index 64089f6f5fa..25d966b1324 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/IndexingValuesTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/IndexingValuesTestCase.java @@ -22,7 +22,7 @@ public class IndexingValuesTestCase { @Test public void requireThatInputOtherFieldThrows() throws IOException, ParseException { assertBuildFails("src/test/examples/indexing_input_other_field.sd", - "For search 'indexing_input_other_field', field 'bar': Indexing expression 'input foo' " + + "For schema 'indexing_input_other_field', field 'bar': Indexing expression 'input foo' " + "attempts to modify the value of the document field 'bar'. " + "Use a field outside the document block instead."); } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/MatchedElementsOnlyResolverTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/MatchedElementsOnlyResolverTestCase.java index 80c3fa48d4e..fc44d61541e 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/MatchedElementsOnlyResolverTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/MatchedElementsOnlyResolverTestCase.java @@ -134,7 +134,8 @@ public class MatchedElementsOnlyResolverTestCase { " }", "}"); - var search = buildSearch(joinLines("field my_field type array<string> {", + var search = buildSearch(joinLines( + "field my_field type array<string> {", " indexing: attribute | summary", "}"), documentSummary); @@ -147,7 +148,7 @@ public class MatchedElementsOnlyResolverTestCase { @Test public void unsupported_field_type_throws() throws ParseException { exceptionRule.expect(IllegalArgumentException.class); - exceptionRule.expectMessage("For search 'test', document summary 'default', summary field 'my_field': " + + exceptionRule.expectMessage("For schema 'test', document summary 'default', summary field 'my_field': " + "'matched-elements-only' is not supported for this field type. " + "Supported field types are: array of primitive, weighted set of primitive, " + "array of simple struct, map of primitive type to simple struct, " + diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/PagedAttributeValidatorTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/PagedAttributeValidatorTestCase.java index 038bfc9ddbf..360072c1da7 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/PagedAttributeValidatorTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/PagedAttributeValidatorTestCase.java @@ -31,13 +31,14 @@ public class PagedAttributeValidatorTestCase { createFromString(getSd(fieldType)); fail("Expected exception"); } catch (IllegalArgumentException e) { - assertEquals("For search 'test', field 'foo': The 'paged' attribute setting is only supported for dense tensor types", + assertEquals("For schema 'test', field 'foo': The 'paged' attribute setting is only supported for dense tensor types", e.getMessage()); } } private String getSd(String type) { - return joinLines("search test {", + return joinLines( + "schema test {", " document test {", " field foo type " + type + "{", " indexing: attribute", diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/PositionTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/PositionTestCase.java index e6f00646758..67e47b7f2ae 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/PositionTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/PositionTestCase.java @@ -53,7 +53,7 @@ public class PositionTestCase { SearchBuilder.buildFromFile("src/test/examples/position_index.sd"); fail(); } catch (IllegalArgumentException e) { - assertEquals("For search 'position_index', field 'pos': Indexing of data type 'position' is not " + + assertEquals("For schema 'position_index', field 'pos': Indexing of data type 'position' is not " + "supported, replace 'index' statement with 'attribute'.", e.getMessage()); } } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/ReservedDocumentNamesTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/ReservedDocumentNamesTestCase.java index 3e61cec54da..6d722138871 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/ReservedDocumentNamesTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/ReservedDocumentNamesTestCase.java @@ -21,7 +21,7 @@ public class ReservedDocumentNamesTestCase extends AbstractExportingTestCase { assertCorrectDeriving("reserved_position"); fail(); } catch (IllegalArgumentException e) { - assertEquals("For search 'position': Document name 'position' is reserved.", e.getMessage()); + assertEquals("For schema 'position': Document name 'position' is reserved.", e.getMessage()); } } } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/SchemaMustHaveDocumentTest.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/SchemaMustHaveDocumentTest.java index 53ca4bf10a5..34572280d01 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/SchemaMustHaveDocumentTest.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/SchemaMustHaveDocumentTest.java @@ -21,7 +21,7 @@ public class SchemaMustHaveDocumentTest { fail("SD without document"); } catch (IllegalArgumentException e) { if (!e.getMessage() - .contains("For search 'imageconfig': A search specification must have an equally named document inside of it.")) { + .contains("For schema 'imageconfig': A search specification must have an equally named document inside of it.")) { throw e; } } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/SummaryFieldsMustHaveValidSourceTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/SummaryFieldsMustHaveValidSourceTestCase.java index ec6a7e7acf9..014ca4ec5e9 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/SummaryFieldsMustHaveValidSourceTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/SummaryFieldsMustHaveValidSourceTestCase.java @@ -24,7 +24,7 @@ public class SummaryFieldsMustHaveValidSourceTestCase extends AbstractSchemaTest SearchBuilder.buildFromFile("src/test/examples/invalidsummarysource.sd"); fail("This should throw and never get here"); } catch (IllegalArgumentException e) { - assertEquals("For search 'invalidsummarysource', summary class 'baz', summary field 'cox': there is no valid source 'nonexistingfield'.", e.getMessage()); + assertEquals("For schema 'invalidsummarysource', summary class 'baz', summary field 'cox': there is no valid source 'nonexistingfield'.", e.getMessage()); } } @@ -34,7 +34,7 @@ public class SummaryFieldsMustHaveValidSourceTestCase extends AbstractSchemaTest SearchBuilder.buildFromFile("src/test/examples/invalidimplicitsummarysource.sd"); fail("This should throw and never get here"); } catch (IllegalArgumentException e) { - assertEquals("For search 'invalidsummarysource', summary class 'baz', summary field 'cox': there is no valid source 'cox'.", e.getMessage()); + assertEquals("For schema 'invalidsummarysource', summary class 'baz', summary field 'cox': there is no valid source 'cox'.", e.getMessage()); } } @@ -44,7 +44,7 @@ public class SummaryFieldsMustHaveValidSourceTestCase extends AbstractSchemaTest SearchBuilder.buildFromFile("src/test/examples/invalidselfreferringsummary.sd"); fail("This should throw and never get here"); } catch (IllegalArgumentException e) { - assertEquals("For search 'invalidselfreferringsummary', summary class 'withid', summary field 'w': there is no valid source 'w'.", e.getMessage()); + assertEquals("For schema 'invalidselfreferringsummary', summary class 'withid', summary field 'w': there is no valid source 'w'.", e.getMessage()); } } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/TensorFieldTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/TensorFieldTestCase.java index c8b0a826d48..cef00346fe7 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/TensorFieldTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/TensorFieldTestCase.java @@ -26,7 +26,7 @@ public class TensorFieldTestCase { fail("Expected exception"); } catch (IllegalArgumentException e) { - assertEquals("For search 'test', field 'f1': A field with collection type of tensor is not supported. Use simple type 'tensor' instead.", + assertEquals("For schema 'test', field 'f1': A field with collection type of tensor is not supported. Use simple type 'tensor' instead.", e.getMessage()); } } @@ -38,7 +38,7 @@ public class TensorFieldTestCase { fail("Expected exception"); } catch (IllegalArgumentException e) { - assertEquals("For search 'test', field 'f1': A tensor of type 'tensor(x{})' does not support having an 'index'. " + + assertEquals("For schema 'test', field 'f1': A tensor of type 'tensor(x{})' does not support having an 'index'. " + "Currently, only tensors with 1 indexed dimension supports that.", e.getMessage()); } @@ -51,7 +51,7 @@ public class TensorFieldTestCase { fail("Expected exception"); } catch (IllegalArgumentException e) { - assertEquals("For search 'test', field 'f1': An attribute of type 'tensor' cannot be 'fast-search'.", e.getMessage()); + assertEquals("For schema 'test', field 'f1': An attribute of type 'tensor' cannot be 'fast-search'.", e.getMessage()); } } @@ -98,7 +98,7 @@ public class TensorFieldTestCase { fail("Expected exception"); } catch (IllegalArgumentException e) { - assertEquals("For search 'test', field 't1': A tensor that has an index must also be an attribute.", e.getMessage()); + assertEquals("For schema 'test', field 't1': A tensor that has an index must also be an attribute.", e.getMessage()); } } @@ -115,7 +115,7 @@ public class TensorFieldTestCase { fail("Expected exception"); } catch (IllegalArgumentException e) { - assertEquals("For search 'test', field 't1': " + + assertEquals("For schema 'test', field 't1': " + "A tensor that specifies hnsw index parameters must also specify 'index' in 'indexing'", e.getMessage()); } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/ValidateFieldTypesTest.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/ValidateFieldTypesTest.java index a3032acd9cc..08c123b5578 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/ValidateFieldTypesTest.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/ValidateFieldTypesTest.java @@ -43,7 +43,7 @@ public class ValidateFieldTypesTest { ValidateFieldTypes validator = new ValidateFieldTypes(schema, null, null, null); exceptionRule.expect(IllegalArgumentException.class); exceptionRule.expectMessage( - "For search '" + DOCUMENT_NAME + "', field '" + IMPORTED_FIELD_NAME + "': Incompatible types. " + + "For schema '" + DOCUMENT_NAME + "', field '" + IMPORTED_FIELD_NAME + "': Incompatible types. " + "Expected int for summary field '" + IMPORTED_FIELD_NAME + "', got string."); validator.process(true, false); } |