From e4651cd18ffa22ceec76ea982be8a9fbe171b4b1 Mon Sep 17 00:00:00 2001 From: Jon Bratseth Date: Tue, 19 Oct 2021 14:34:54 +0200 Subject: Use 'schema' not 'search' in messages --- .../searchdefinition/DocumentModelBuilder.java | 4 ++-- .../searchdefinition/document/SDDocumentType.java | 27 +++++++++------------- .../processing/FastAccessValidator.java | 7 ++---- .../processing/FieldSetSettings.java | 4 ++-- .../processing/ImportedFieldsResolver.java | 7 +++--- .../searchdefinition/processing/MakeAliases.java | 2 +- .../processing/MatchedElementsOnlyResolver.java | 2 +- .../searchdefinition/processing/Processor.java | 16 ++++++------- .../processing/ReservedDocumentNames.java | 7 +++--- .../processing/SearchMustHaveDocument.java | 4 ++-- .../SummaryFieldsMustHaveValidSource.java | 2 +- .../processing/SummaryNamesFieldCollisions.java | 4 ++-- .../application/validation/NoPrefixForIndexes.java | 2 +- .../validation/RoutingSelectorValidator.java | 2 +- .../searchdefinition/NameFieldCheckTestCase.java | 3 ++- .../PredicateDataTypeTestCase.java | 4 ++-- .../com/yahoo/searchdefinition/SchemaTestCase.java | 1 + .../com/yahoo/searchdefinition/StructTestCase.java | 2 +- .../yahoo/searchdefinition/SummaryTestCase.java | 14 +++++------ .../AdjustPositionSummaryFieldsTestCase.java | 16 ++++++------- .../processing/BoolAttributeValidatorTestCase.java | 7 +++--- .../processing/DictionaryTestCase.java | 18 +++++++-------- .../processing/FastAccessValidatorTest.java | 6 ++--- .../processing/ImportedFieldsResolverTestCase.java | 10 ++++---- .../processing/ImportedFieldsTestCase.java | 18 ++++++++------- .../processing/IndexingInputsTestCase.java | 9 ++++---- .../processing/IndexingOutputsTestCase.java | 4 ++-- .../processing/IndexingValidationTestCase.java | 14 +++++------ .../processing/IndexingValuesTestCase.java | 2 +- .../MatchedElementsOnlyResolverTestCase.java | 5 ++-- .../PagedAttributeValidatorTestCase.java | 5 ++-- .../processing/PositionTestCase.java | 2 +- .../processing/ReservedDocumentNamesTestCase.java | 2 +- .../processing/SchemaMustHaveDocumentTest.java | 2 +- .../SummaryFieldsMustHaveValidSourceTestCase.java | 6 ++--- .../processing/TensorFieldTestCase.java | 10 ++++---- .../processing/ValidateFieldTypesTest.java | 2 +- .../validation/NoPrefixForIndexesTest.java | 4 ++-- 38 files changed, 127 insertions(+), 129 deletions(-) (limited to 'config-model') diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/DocumentModelBuilder.java b/config-model/src/main/java/com/yahoo/searchdefinition/DocumentModelBuilder.java index 576b23b4dce..14404528acc 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/DocumentModelBuilder.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/DocumentModelBuilder.java @@ -354,10 +354,10 @@ public class DocumentModelBuilder { throw new IllegalArgumentException("Data type '" + sdoc.getName() + "' is not a struct => tostring='" + sdoc.toString() + "'."); } } - for (AnnotationType annotation : sdoc.getAnnotations()) { + for (AnnotationType annotation : sdoc.getAnnotations().values()) { dt.add(annotation); } - for (AnnotationType annotation : sdoc.getAnnotations()) { + for (AnnotationType annotation : sdoc.getAnnotations().values()) { SDAnnotationType sa = (SDAnnotationType) annotation; if (annotation.getInheritedTypes().isEmpty() && (sa.getInherits() != null) ) { annotationInheritance.put(annotation, sa.getInherits()); diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/document/SDDocumentType.java b/config-model/src/main/java/com/yahoo/searchdefinition/document/SDDocumentType.java index 752eb856afa..6424db1c2dd 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/document/SDDocumentType.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/document/SDDocumentType.java @@ -66,17 +66,15 @@ public class SDDocumentType implements Cloneable, Serializable { /** * For adding structs defined in document scope * - * @param dt The struct to add. + * @param dt the struct to add * @return self, for chaining */ public SDDocumentType addType(SDDocumentType dt) { NewDocumentType.Name name = new NewDocumentType.Name(dt.getName()); - if (getType(name) != null) { - throw new IllegalArgumentException("Data type '" + name.toString() + "' has already been used."); - } - if (name.getName() == docType.getName()) { - throw new IllegalArgumentException("Data type '" + name.toString() + "' can not have same name as its defining document."); - } + if (getType(name) != null) + throw new IllegalArgumentException("Data type '" + name + "' has already been used."); + if (name.getName() == docType.getName()) + throw new IllegalArgumentException("Data type '" + name + "' can not have same name as its defining document."); ownedTypes.put(name, dt); return this; } @@ -113,12 +111,11 @@ public class SDDocumentType implements Cloneable, Serializable { return this; } - /** - * Access to all owned datatypes. - * @return all types - */ + /** Returns all owned datatypes. */ public Collection getTypes() { return ownedTypes.values(); } - public Collection getAnnotations() { return annotationTypes.getTypes().values(); } + + // TODO: Include inherited + public Map getAnnotations() { return annotationTypes.getTypes(); } public AnnotationType findAnnotation(String name) { return annotationTypes.getType(name); } public Collection getAllTypes() { @@ -251,7 +248,7 @@ public class SDDocumentType implements Cloneable, Serializable { for (Field pField : parent.fieldSet()) { if (pField.getName().equals(field.getName())) { if (!pField.getDataType().equals(field.getDataType())) { - throw new IllegalArgumentException("For search '" + getName() + "', field '" + field.getName() + + throw new IllegalArgumentException("For " + this + ", field '" + field.getName() + "': Datatype can not be different from that of same field " + "in the supertype '" + parent.getName() + "'"); } @@ -300,11 +297,9 @@ public class SDDocumentType implements Cloneable, Serializable { return docType.getFieldCount(); } - - @Override public String toString() { - return "SD document type '" + docType.getName() + "'"; + return "document type '" + docType.getName() + "'"; } private static SDDocumentType createSDDocumentType(StructDataType structType) { diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/processing/FastAccessValidator.java b/config-model/src/main/java/com/yahoo/searchdefinition/processing/FastAccessValidator.java index 5605f66cd69..60cc5c1cbb4 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/processing/FastAccessValidator.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/processing/FastAccessValidator.java @@ -31,11 +31,8 @@ public class FastAccessValidator extends Processor { .collect(Collectors.joining(", ")); if ( ! invalidAttributes.isEmpty()) { throw new IllegalArgumentException( - String.format( - "For search '%s': The following attributes have a type that is incompatible with fast-access: %s. " + - "Predicate, tensor and reference attributes are incompatible with fast-access.", - schema.getName(), - invalidAttributes)); + "For " + schema + ": The following attributes have a type that is incompatible with fast-access: " + + invalidAttributes + ". Predicate, tensor and reference attributes are incompatible with fast-access."); } } diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/processing/FieldSetSettings.java b/config-model/src/main/java/com/yahoo/searchdefinition/processing/FieldSetSettings.java index 0598bb70afd..1c50f78b539 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/processing/FieldSetSettings.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/processing/FieldSetSettings.java @@ -43,8 +43,8 @@ public class FieldSetSettings extends Processor { private void checkFieldNames(Schema schema, FieldSet fieldSet) { for (String field : fieldSet.getFieldNames()) { if (schema.getField(field) == null) - throw new IllegalArgumentException("For search '" + schema.getName() + - "': Field '" + field + "' in " + fieldSet + " does not exist."); + throw new IllegalArgumentException("For " + schema + ": Field '" + field + "' in " + + fieldSet + " does not exist."); } } diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/processing/ImportedFieldsResolver.java b/config-model/src/main/java/com/yahoo/searchdefinition/processing/ImportedFieldsResolver.java index ed04303a3ba..f8a28061897 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/processing/ImportedFieldsResolver.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/processing/ImportedFieldsResolver.java @@ -26,7 +26,7 @@ import static com.yahoo.searchdefinition.document.ComplexAttributeFieldUtils.isM import static com.yahoo.searchdefinition.document.ComplexAttributeFieldUtils.isMapOfSimpleStruct; /** - * Iterates all imported fields from SD-parsing and validates and resolves them into concrete fields from referenced document types. + * Iterates all imported fields from schema parsing and validates and resolves them into concrete fields from referenced document types. * * @author geirst */ @@ -193,14 +193,15 @@ public class ImportedFieldsResolver extends Processor { } private void fail(TemporaryImportedField importedField, String msg) { - throw new IllegalArgumentException("For search '" + schema.getName() + "', import field '" + importedField.fieldName() + "': " + msg); + throw new IllegalArgumentException("For " + schema + ", import field '" + + importedField.fieldName() + "': " + msg); } private void fail(TemporaryImportedField importedField, String importedNestedFieldName, String msg) { if (importedField.fieldName().equals(importedNestedFieldName)) { fail(importedField, msg); } - throw new IllegalArgumentException("For search '" + schema.getName() + "', import field '" + + throw new IllegalArgumentException("For " + schema + ", import field '" + importedField.fieldName() + "' (nested to '" + importedNestedFieldName + "'): " + msg); } } diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/processing/MakeAliases.java b/config-model/src/main/java/com/yahoo/searchdefinition/processing/MakeAliases.java index 48712b3bb35..14d75c6438e 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/processing/MakeAliases.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/processing/MakeAliases.java @@ -31,7 +31,7 @@ public class MakeAliases extends Processor { for (Map.Entry e : field.getAliasToName().entrySet()) { String alias = e.getKey(); String name = e.getValue(); - String errMsg = "For search '" + schema.getName() + "': alias '" + alias + "' "; + String errMsg = "For " + schema + ": alias '" + alias + "' "; if (validate && schema.existsIndex(alias)) { throw new IllegalArgumentException(errMsg + "is illegal since it is the name of an index."); } diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/processing/MatchedElementsOnlyResolver.java b/config-model/src/main/java/com/yahoo/searchdefinition/processing/MatchedElementsOnlyResolver.java index 7e78b76eb7f..709c79cd79b 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/processing/MatchedElementsOnlyResolver.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/processing/MatchedElementsOnlyResolver.java @@ -88,7 +88,7 @@ public class MatchedElementsOnlyResolver extends Processor { } private String formatError(Schema schema, DocumentSummary summary, SummaryField field, String msg) { - return "For search '" + schema.getName() + "', document summary '" + summary.getName() + return "For " + schema + ", document summary '" + summary.getName() + "', summary field '" + field.getName() + "': " + msg; } diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/processing/Processor.java b/config-model/src/main/java/com/yahoo/searchdefinition/processing/Processor.java index 2b18ee27f73..e8f60335362 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/processing/Processor.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/processing/Processor.java @@ -112,12 +112,12 @@ public abstract class Processor { return someRankSettings.iterator(); } - protected String formatError(String searchName, String fieldName, String msg) { - return "For search '" + searchName + "', field '" + fieldName + "': " + msg; + protected String formatError(String schemaName, String fieldName, String msg) { + return "For schema '" + schemaName + "', field '" + fieldName + "': " + msg; } - protected RuntimeException newProcessException(String searchName, String fieldName, String msg) { - return new IllegalArgumentException(formatError(searchName, fieldName, msg)); + protected RuntimeException newProcessException(String schemaName, String fieldName, String msg) { + return new IllegalArgumentException(formatError(schemaName, fieldName, msg)); } protected RuntimeException newProcessException(Schema schema, Field field, String msg) { @@ -128,8 +128,8 @@ public abstract class Processor { throw newProcessException(schema, field, msg); } - protected void warn(String searchName, String fieldName, String message) { - String fullMsg = formatError(searchName, fieldName, message); + protected void warn(String schemaName, String fieldName, String message) { + String fullMsg = formatError(schemaName, fieldName, message); deployLogger.logApplicationPackage(Level.WARNING, fullMsg); } @@ -137,8 +137,8 @@ public abstract class Processor { warn(schema.getName(), field.getName(), message); } - protected void info(String searchName, String fieldName, String message) { - String fullMsg = formatError(searchName, fieldName, message); + protected void info(String schemaName, String fieldName, String message) { + String fullMsg = formatError(schemaName, fieldName, message); deployLogger.logApplicationPackage(Level.INFO, fullMsg); } diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/processing/ReservedDocumentNames.java b/config-model/src/main/java/com/yahoo/searchdefinition/processing/ReservedDocumentNames.java index 549f53d6d8d..4a39a52a005 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/processing/ReservedDocumentNames.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/processing/ReservedDocumentNames.java @@ -32,9 +32,8 @@ public class ReservedDocumentNames extends Processor { if ( ! validate) return; String docName = schema.getDocument().getName(); - if (RESERVED_NAMES.contains(docName)) { - throw new IllegalArgumentException("For search '" + schema.getName() + "': Document name '" + docName + - "' is reserved."); - } + if (RESERVED_NAMES.contains(docName)) + throw new IllegalArgumentException("For " + schema + ": Document name '" + docName + "' is reserved."); } + } diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/processing/SearchMustHaveDocument.java b/config-model/src/main/java/com/yahoo/searchdefinition/processing/SearchMustHaveDocument.java index a48c410fe11..68717f1f06b 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/processing/SearchMustHaveDocument.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/processing/SearchMustHaveDocument.java @@ -23,8 +23,8 @@ public class SearchMustHaveDocument extends Processor { if ( ! validate) return; if (schema.getDocument() == null) - throw new IllegalArgumentException("For search '" + schema.getName() + - "': A search specification must have an equally named document inside of it."); + throw new IllegalArgumentException("For " + schema + + ": A search specification must have an equally named document inside of it."); } } diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/processing/SummaryFieldsMustHaveValidSource.java b/config-model/src/main/java/com/yahoo/searchdefinition/processing/SummaryFieldsMustHaveValidSource.java index 6d55a52f959..2e2144b819d 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/processing/SummaryFieldsMustHaveValidSource.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/processing/SummaryFieldsMustHaveValidSource.java @@ -56,7 +56,7 @@ public class SummaryFieldsMustHaveValidSource extends Processor { private void verifySource(String source, SummaryField summaryField, DocumentSummary summary) { if ( ! isValid(source, summaryField, summary) ) { - throw new IllegalArgumentException("For search '" + schema.getName() + "', summary class '" + + throw new IllegalArgumentException("For " + schema + ", summary class '" + summary.getName() + "'," + " summary field '" + summaryField.getName() + "': there is no valid source '" + source + "'."); } diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/processing/SummaryNamesFieldCollisions.java b/config-model/src/main/java/com/yahoo/searchdefinition/processing/SummaryNamesFieldCollisions.java index 6a51cd649b6..1c6f8d54ea3 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/processing/SummaryNamesFieldCollisions.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/processing/SummaryNamesFieldCollisions.java @@ -41,8 +41,8 @@ public class SummaryNamesFieldCollisions extends Processor { String prevSource = prevClassAndSource.getSecond(); if ( ! prevClass.equals(summary.getName())) { if ( ! prevSource.equals(source.getName())) { - throw new IllegalArgumentException("For search '" + schema.getName() + - "', summary class '" + summary.getName() + "'," + + throw new IllegalArgumentException("For " + schema + + ", summary class '" + summary.getName() + "'," + " summary field '" + summaryField.getName() + "':" + " Can not use source '" + source.getName() + "' for this summary field, an equally named field in summary class '" + diff --git a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/NoPrefixForIndexes.java b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/NoPrefixForIndexes.java index 25085683ca6..67667674ea9 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/NoPrefixForIndexes.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/NoPrefixForIndexes.java @@ -48,7 +48,7 @@ public class NoPrefixForIndexes extends Validator { } private void failField(Schema schema, ImmutableSDField field) { - throw new IllegalArgumentException("For search '" + schema.getName() + "', field '" + field.getName() + + throw new IllegalArgumentException("For " + schema + ", field '" + field.getName() + "': match/index:prefix is not supported for indexes."); } } diff --git a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/RoutingSelectorValidator.java b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/RoutingSelectorValidator.java index 8f9a604f65f..7112c4b9a0a 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/RoutingSelectorValidator.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/RoutingSelectorValidator.java @@ -10,7 +10,6 @@ import com.yahoo.vespa.model.search.IndexedSearchCluster; /** * Validates routing selector for search and content clusters - * */ public class RoutingSelectorValidator extends Validator { @@ -30,4 +29,5 @@ public class RoutingSelectorValidator extends Validator { } } } + } 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 for index field 'grpphotoids64', got string.", e.getMessage()); + assertEquals("For schema 'duplicatenamesinsearch', field 'grpphotoids64': " + + "Incompatible types. Expected Array 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 (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 {", + var search = buildSearch(joinLines( + "field my_field type array {", " 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); } diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/NoPrefixForIndexesTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/NoPrefixForIndexesTest.java index 52a7d383587..5f0296588db 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/NoPrefixForIndexesTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/NoPrefixForIndexesTest.java @@ -28,7 +28,7 @@ public class NoPrefixForIndexesTest { new VespaModelCreatorWithFilePkg("src/test/cfg/application/validation/prefix_index/").create(); fail(); } catch (IllegalArgumentException e) { - assertEquals("For search 'simple', field 'artist': match/index:prefix is not supported for indexes.", e.getMessage()); + assertEquals("For schema 'simple', field 'artist': match/index:prefix is not supported for indexes.", e.getMessage()); } } @@ -38,7 +38,7 @@ public class NoPrefixForIndexesTest { new VespaModelCreatorWithFilePkg("src/test/cfg/application/validation/prefix_index_and_attribute/").create(); fail(); } catch (IllegalArgumentException e) { - assertEquals("For search 'simple', field 'artist': match/index:prefix is not supported for indexes.", e.getMessage()); + assertEquals("For schema 'simple', field 'artist': match/index:prefix is not supported for indexes.", e.getMessage()); } } } -- cgit v1.2.3