diff options
author | Geir Storli <geirst@yahooinc.com> | 2022-07-13 15:34:00 +0000 |
---|---|---|
committer | Geir Storli <geirst@yahooinc.com> | 2022-07-13 15:50:52 +0000 |
commit | c991da942ac3e3dcbc4a170ebca1b32a0a90074a (patch) | |
tree | 11819294213d6fe6ee45ff560f5a18ea2bb75945 /config-model/src/main/java | |
parent | 2a2a9f34ff5a6a9c8b26fbd81819507ce94e603c (diff) |
Change to log warning (for now) as hosted applications are using this wrong.
Diffstat (limited to 'config-model/src/main/java')
-rw-r--r-- | config-model/src/main/java/com/yahoo/vespa/model/application/validation/ComplexFieldsWithStructFieldIndexesValidator.java | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/ComplexFieldsWithStructFieldIndexesValidator.java b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/ComplexFieldsWithStructFieldIndexesValidator.java index a18ce7e245d..fdd71ebccc5 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/ComplexFieldsWithStructFieldIndexesValidator.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/ComplexFieldsWithStructFieldIndexesValidator.java @@ -1,6 +1,7 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.model.application.validation; +import com.yahoo.config.application.api.DeployLogger; import com.yahoo.config.model.deploy.DeployState; import com.yahoo.schema.Schema; import com.yahoo.schema.document.ImmutableSDField; @@ -9,6 +10,7 @@ import com.yahoo.vespa.model.VespaModel; import java.util.ArrayList; import java.util.Collection; import java.util.List; +import java.util.logging.Level; import java.util.stream.Collectors; /** @@ -28,21 +30,22 @@ public class ComplexFieldsWithStructFieldIndexesValidator extends Validator { continue; } for (var spec : cluster.schemas().values()) { - validateComplexFields(cluster.getClusterName(), spec.fullSchema()); + validateComplexFields(cluster.getClusterName(), spec.fullSchema(), deployState.getDeployLogger()); } } } - private static void validateComplexFields(String clusterName, Schema schema) { + private static void validateComplexFields(String clusterName, Schema schema, DeployLogger logger) { String unsupportedFields = schema.allFields() .filter(field -> hasStructFieldsWithIndex(field)) .map(ComplexFieldsWithStructFieldIndexesValidator::toString) .collect(Collectors.joining(", ")); if (!unsupportedFields.isEmpty()) { - throw new IllegalArgumentException( - String.format("For cluster '%s', schema '%s': The following complex fields have struct fields with 'indexing: index' which is not supported: %s. " + - "Change to 'indexing: attribute' instead", + // TODO (Vespa 9 or before): Change back to an exception when no applications are using it wrong. + logger.logApplicationPackage(Level.WARNING, + String.format("For cluster '%s', schema '%s': The following complex fields have struct fields with 'indexing: index' which is not supported and has no effect: %s. " + + "Remove setting or change to 'indexing: attribute' if needed for matching.", clusterName, schema.getName(), unsupportedFields)); } } |