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/main/java/com/yahoo | |
parent | fb81412a6718ce2419ceee89a09c6705a4578487 (diff) |
Use 'schema' not 'search' in messages
Diffstat (limited to 'config-model/src/main/java/com/yahoo')
14 files changed, 41 insertions, 49 deletions
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<SDDocumentType> getTypes() { return ownedTypes.values(); } - public Collection<AnnotationType> getAnnotations() { return annotationTypes.getTypes().values(); } + + // TODO: Include inherited + public Map<String, AnnotationType> getAnnotations() { return annotationTypes.getTypes(); } public AnnotationType findAnnotation(String name) { return annotationTypes.getType(name); } public Collection<SDDocumentType> 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<String, String> 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 { } } } + } |