From c991da942ac3e3dcbc4a170ebca1b32a0a90074a Mon Sep 17 00:00:00 2001 From: Geir Storli Date: Wed, 13 Jul 2022 15:34:00 +0000 Subject: Change to log warning (for now) as hosted applications are using this wrong. --- .../ComplexFieldsWithStructFieldIndexesValidator.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'config-model/src/main/java') 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)); } } -- cgit v1.2.3