diff options
author | Jon Bratseth <bratseth@gmail.com> | 2022-05-16 11:01:11 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2022-05-16 11:01:11 +0200 |
commit | 34be3c6d703de92df4a9bc339105e416a344a325 (patch) | |
tree | 013bfaeb2dfc739234398ad2840e6aa7bc43aec5 /config-model/src/main/java/com/yahoo/searchdefinition | |
parent | e4e4740cd2c4d12feef9776e71de5a86de95bda0 (diff) |
Move config generation down
Diffstat (limited to 'config-model/src/main/java/com/yahoo/searchdefinition')
3 files changed, 17 insertions, 12 deletions
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/Schema.java b/config-model/src/main/java/com/yahoo/searchdefinition/Schema.java index db105edc9d4..147fee05820 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/Schema.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/Schema.java @@ -218,7 +218,7 @@ public class Schema implements ImmutableSchema { */ public void addDocument(SDDocumentType document) { if (documentType != null) { - throw new IllegalArgumentException("Searchdefinition cannot have more than one document"); + throw new IllegalArgumentException("Schema cannot have more than one document"); } documentType = document; } diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/derived/FileDistributedConstants.java b/config-model/src/main/java/com/yahoo/searchdefinition/derived/FileDistributedConstants.java index 8de86beacdb..e4c5d9fb34e 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/derived/FileDistributedConstants.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/derived/FileDistributedConstants.java @@ -5,12 +5,14 @@ import com.yahoo.config.application.api.FileRegistry; import com.yahoo.searchdefinition.DistributableResource; import com.yahoo.searchdefinition.RankProfile; import com.yahoo.tensor.TensorType; +import com.yahoo.vespa.config.search.core.RankingConstantsConfig; import java.util.Collection; import java.util.Collections; import java.util.LinkedHashMap; import java.util.Map; import java.util.function.Function; +import java.util.logging.Logger; /** * Constant values for ranking/model execution tied to a rank profile, @@ -20,6 +22,7 @@ import java.util.function.Function; */ public class FileDistributedConstants { + private static final Logger log = Logger.getLogger(FileDistributedConstants.class.getName()); private final Map<String, DistributableConstant> constants; public FileDistributedConstants(FileRegistry fileRegistry, Collection<RankProfile.Constant> constants) { @@ -41,6 +44,18 @@ public class FileDistributedConstants { /** Returns a read-only map of the constants in this indexed by name. */ public Map<String, DistributableConstant> asMap() { return constants; } + public void getConfig(RankingConstantsConfig.Builder builder) { + for (var constant : constants.values()) { + if ("".equals(constant.getFileReference())) + log.warning("Illegal file reference " + constant); // Let tests pass ... we should find a better way + else + builder.constant(new RankingConstantsConfig.Constant.Builder() + .name(constant.getName()) + .fileref(constant.getFileReference()) + .type(constant.getType())); + } + } + public static class DistributableConstant extends DistributableResource { private final TensorType tensorType; diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/derived/RankProfileList.java b/config-model/src/main/java/com/yahoo/searchdefinition/derived/RankProfileList.java index d415f7d0d6e..65c0963856a 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/derived/RankProfileList.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/derived/RankProfileList.java @@ -2,7 +2,6 @@ package com.yahoo.searchdefinition.derived; import ai.vespa.rankingexpression.importer.configmodelview.ImportedMlModels; -import com.yahoo.config.application.api.DeployLogger; import com.yahoo.config.model.api.ModelContext; import com.yahoo.config.model.deploy.DeployState; import com.yahoo.search.query.profile.QueryProfileRegistry; @@ -29,7 +28,6 @@ import java.util.Set; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; -import java.util.logging.Level; import java.util.logging.Logger; /** @@ -199,15 +197,7 @@ public class RankProfileList extends Derived implements RankProfilesConfig.Produ } public void getConfig(RankingConstantsConfig.Builder builder) { - for (var constant : constants.asMap().values()) { - if ("".equals(constant.getFileReference())) - log.warning("Illegal file reference " + constant); // Let tests pass ... we should find a better way - else - builder.constant(new RankingConstantsConfig.Constant.Builder() - .name(constant.getName()) - .fileref(constant.getFileReference()) - .type(constant.getType())); - } + constants.getConfig(builder); } public void getConfig(OnnxModelsConfig.Builder builder) { |