diff options
Diffstat (limited to 'config-model/src/main/java/com/yahoo/vespa/model/application/validation/NoPrefixForIndexes.java')
-rw-r--r-- | config-model/src/main/java/com/yahoo/vespa/model/application/validation/NoPrefixForIndexes.java | 25 |
1 files changed, 13 insertions, 12 deletions
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 15d293e4abc..15d3e63c7fa 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 @@ -1,15 +1,16 @@ // Copyright Vespa.ai. 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.schema.Index; +import com.yahoo.config.model.deploy.DeployState; import com.yahoo.schema.Schema; -import com.yahoo.schema.derived.DerivedConfiguration; import com.yahoo.schema.document.ImmutableSDField; import com.yahoo.schema.document.MatchAlgorithm; -import com.yahoo.vespa.model.application.validation.Validation.Context; +import com.yahoo.schema.Index; +import com.yahoo.schema.derived.DerivedConfiguration; +import com.yahoo.vespa.model.VespaModel; +import com.yahoo.vespa.model.search.SearchCluster; import com.yahoo.vespa.model.search.DocumentDatabase; import com.yahoo.vespa.model.search.IndexedSearchCluster; -import com.yahoo.vespa.model.search.SearchCluster; import java.util.Map; @@ -18,11 +19,11 @@ import java.util.Map; * * @author vegardh */ -public class NoPrefixForIndexes implements Validator { +public class NoPrefixForIndexes extends Validator { @Override - public void validate(Context context) { - for (SearchCluster cluster : context.model().getSearchClusters()) { + public void validate(VespaModel model, DeployState deployState) { + for (SearchCluster cluster : model.getSearchClusters()) { if (cluster instanceof IndexedSearchCluster) { IndexedSearchCluster sc = (IndexedSearchCluster) cluster; for (DocumentDatabase docDb : sc.getDocumentDbs()) { @@ -32,11 +33,11 @@ public class NoPrefixForIndexes implements Validator { if (field.doesIndexing()) { //if (!field.getIndexTo().isEmpty() && !field.getIndexTo().contains(field.getName())) continue; if (field.getMatching().getAlgorithm().equals(MatchAlgorithm.PREFIX)) { - failField(context, schema, field); + failField(schema, field); } for (Map.Entry<String, Index> e : field.getIndices().entrySet()) { if (e.getValue().isPrefix()) { - failField(context, schema, field); + failField(schema, field); } } } @@ -46,8 +47,8 @@ public class NoPrefixForIndexes implements Validator { } } - private void failField(Context context, Schema schema, ImmutableSDField field) { - context.illegal("For " + schema + ", field '" + field.getName() + - "': match/index:prefix is not supported for indexes."); + private void failField(Schema schema, ImmutableSDField field) { + throw new IllegalArgumentException("For " + schema + ", field '" + field.getName() + + "': match/index:prefix is not supported for indexes."); } } |