diff options
Diffstat (limited to 'config-model')
5 files changed, 18 insertions, 77 deletions
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/derived/DerivedConfiguration.java b/config-model/src/main/java/com/yahoo/searchdefinition/derived/DerivedConfiguration.java index bb409ab6632..245913d7822 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/derived/DerivedConfiguration.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/derived/DerivedConfiguration.java @@ -15,11 +15,9 @@ import com.yahoo.search.query.profile.QueryProfileRegistry; import com.yahoo.searchdefinition.RankProfileRegistry; import com.yahoo.searchdefinition.Search; import com.yahoo.searchdefinition.derived.validation.Validation; -import com.yahoo.vespa.model.container.search.QueryProfiles; import java.io.IOException; import java.io.Writer; -import java.util.logging.Level; /** * A set of all derived configuration of a search definition. Use this as a facade to individual configurations when @@ -46,7 +44,7 @@ public class DerivedConfiguration { * Creates a complete derived configuration from a search definition. * Only used in tests. * - * @param search the search to derive a configuration from. Derived objects will be snapshots, but this argument is + * @param search The search to derive a configuration from. Derived objects will be snapshots, but this argument is * live. Which means that this object will be inconsistent when the given search definition is later * modified. * @param rankProfileRegistry a {@link com.yahoo.searchdefinition.RankProfileRegistry} @@ -58,11 +56,11 @@ public class DerivedConfiguration { /** * Creates a complete derived configuration snapshot from a search definition. * - * @param search the search to derive a configuration from. Derived objects will be snapshots, but this + * @param search The search to derive a configuration from. Derived objects will be snapshots, but this * argument is live. Which means that this object will be inconsistent when the given * search definition is later modified. * @param deployLogger a {@link DeployLogger} for logging when doing operations on this - * @param deployProperties properties set on deploy + * @param deployProperties Properties set on deploy. * @param rankProfileRegistry a {@link com.yahoo.searchdefinition.RankProfileRegistry} * @param queryProfiles the query profiles of this application */ @@ -122,10 +120,6 @@ public class DerivedConfiguration { exportCfg(new DocumenttypesConfig(documentTypesCfg), toDirectory + "/" + "documenttypes.cfg"); } - public static void exportQueryProfiles(QueryProfileRegistry queryProfileRegistry, String toDirectory) throws IOException { - exportCfg(new QueryProfiles(queryProfileRegistry, (level, message) -> {}).getConfig(), toDirectory + "/" + "query-profiles.cfg"); - } - private static void exportCfg(ConfigInstance instance, String fileName) throws IOException { Writer writer = null; try { diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/search/QueryProfiles.java b/config-model/src/main/java/com/yahoo/vespa/model/container/search/QueryProfiles.java index 0a9618e7b08..0abb0803405 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/container/search/QueryProfiles.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/container/search/QueryProfiles.java @@ -232,7 +232,8 @@ public class QueryProfiles implements Serializable, QueryProfilesConfig.Producer return propB; } - private QueryProfilesConfig.Queryprofile.Queryprofilevariant.Property.Builder createVariantPropertyFieldConfig(String fullName, Object value) { + private QueryProfilesConfig.Queryprofile.Queryprofilevariant.Property.Builder createVariantPropertyFieldConfig( + String fullName, Object value) { QueryProfilesConfig.Queryprofile.Queryprofilevariant.Property.Builder propB = new QueryProfilesConfig.Queryprofile.Queryprofilevariant.Property.Builder(); if (value instanceof SubstituteString) value=value.toString(); // Send only types understood by configBuilder downwards @@ -250,7 +251,7 @@ public class QueryProfiles implements Serializable, QueryProfilesConfig.Producer qtB.matchaspath(true); for (QueryProfileType inherited : profileType.inherited()) qtB.inherit(inherited.getId().stringValue()); - List<FieldDescription> fields = new ArrayList<>(profileType.declaredFields().values()); + List<FieldDescription> fields=new ArrayList<>(profileType.declaredFields().values()); Collections.sort(fields); for (FieldDescription field : fields) qtB.field(createConfig(field)); @@ -259,20 +260,22 @@ public class QueryProfiles implements Serializable, QueryProfilesConfig.Producer private QueryProfilesConfig.Queryprofiletype.Field.Builder createConfig(FieldDescription field) { QueryProfilesConfig.Queryprofiletype.Field.Builder fB = new QueryProfilesConfig.Queryprofiletype.Field.Builder(); - fB.name(field.getName()).type(field.getType().stringValue()); + fB. + name(field.getName()). + type(field.getType().stringValue()); if ( ! field.isOverridable()) fB.overridable(false); if (field.isMandatory()) fB.mandatory(true); - String aliases = toSpaceSeparatedString(field.getAliases()); - if ( ! aliases.isEmpty()) + String aliases=toSpaceSeparatedString(field.getAliases()); + if (!aliases.isEmpty()) fB.alias(aliases); return fB; } public String toSpaceSeparatedString(List<String> list) { - StringBuilder b = new StringBuilder(); - for (Iterator<String> i = list.iterator(); i.hasNext(); ) { + StringBuilder b=new StringBuilder(); + for (Iterator<String> i=list.iterator(); i.hasNext(); ) { b.append(i.next()); if (i.hasNext()) b.append(" "); @@ -287,7 +290,10 @@ public class QueryProfiles implements Serializable, QueryProfilesConfig.Producer } } - /** Returns the config produced by this */ + /** + * The config produced by this + * @return query profiles config + */ public QueryProfilesConfig getConfig() { QueryProfilesConfig.Builder qB = new QueryProfilesConfig.Builder(); getConfig(qB); diff --git a/config-model/src/test/derived/neuralnet/query-profiles.cfg b/config-model/src/test/derived/neuralnet/query-profiles.cfg deleted file mode 100644 index ed69df7895d..00000000000 --- a/config-model/src/test/derived/neuralnet/query-profiles.cfg +++ /dev/null @@ -1,53 +0,0 @@ -queryprofile[].id "default" -queryprofile[].type "DefaultQueryProfileType" -queryprofiletype[].id "DefaultQueryProfileType" -queryprofiletype[].strict false -queryprofiletype[].matchaspath false -queryprofiletype[].field[].name "ranking" -queryprofiletype[].field[].type "query-profile:ranking_0_0" -queryprofiletype[].field[].overridable true -queryprofiletype[].field[].mandatory false -queryprofiletype[].field[].alias "" -queryprofiletype[].id "ranking_0_0" -queryprofiletype[].strict false -queryprofiletype[].matchaspath false -queryprofiletype[].inherit[] "ranking" -queryprofiletype[].field[].name "features" -queryprofiletype[].field[].type "query-profile:features_0_1" -queryprofiletype[].field[].overridable true -queryprofiletype[].field[].mandatory false -queryprofiletype[].field[].alias "rankfeature" -queryprofiletype[].id "features_0_1" -queryprofiletype[].strict false -queryprofiletype[].matchaspath false -queryprofiletype[].field[].name "query(W_0)" -queryprofiletype[].field[].type "tensor(hidden[9],x[9])" -queryprofiletype[].field[].overridable true -queryprofiletype[].field[].mandatory false -queryprofiletype[].field[].alias "" -queryprofiletype[].field[].name "query(W_1)" -queryprofiletype[].field[].type "tensor(hidden[9],out[9])" -queryprofiletype[].field[].overridable true -queryprofiletype[].field[].mandatory false -queryprofiletype[].field[].alias "" -queryprofiletype[].field[].name "query(W_out)" -queryprofiletype[].field[].type "tensor(out[9])" -queryprofiletype[].field[].overridable true -queryprofiletype[].field[].mandatory false -queryprofiletype[].field[].alias "" -queryprofiletype[].field[].name "query(b_0)" -queryprofiletype[].field[].type "tensor(hidden[9])" -queryprofiletype[].field[].overridable true -queryprofiletype[].field[].mandatory false -queryprofiletype[].field[].alias "" -queryprofiletype[].field[].name "query(b_1)" -queryprofiletype[].field[].type "tensor(out[9])" -queryprofiletype[].field[].overridable true -queryprofiletype[].field[].mandatory false -queryprofiletype[].field[].alias "" -queryprofiletype[].field[].name "query(b_out)" -queryprofiletype[].field[].type "tensor(out[1])" -queryprofiletype[].field[].overridable true -queryprofiletype[].field[].mandatory false -queryprofiletype[].field[].alias "" -enableGroupingSessionCache true diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/AbstractExportingTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/AbstractExportingTestCase.java index 8ea53172200..d67df3a5239 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/AbstractExportingTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/AbstractExportingTestCase.java @@ -10,8 +10,6 @@ import com.yahoo.searchdefinition.parser.ParseException; import ai.vespa.rankingexpression.importer.configmodelview.ImportedMlModels; import com.yahoo.vespa.configmodel.producers.DocumentManager; import com.yahoo.vespa.configmodel.producers.DocumentTypes; -import com.yahoo.vespa.model.container.search.QueryProfiles; -import com.yahoo.vespa.model.test.utils.DeployLoggerStub; import java.io.File; import java.io.IOException; @@ -55,7 +53,6 @@ public abstract class AbstractExportingTestCase extends SearchDefinitionTestCase String path = exportConfig(name, config); DerivedConfiguration.exportDocuments(new DocumentManager().produce(builder.getModel(), new DocumentmanagerConfig.Builder()), path); DerivedConfiguration.exportDocuments(new DocumentTypes().produce(builder.getModel(), new DocumenttypesConfig.Builder()), path); - DerivedConfiguration.exportQueryProfiles(builder.getQueryProfileRegistry(), path); return config; } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/NeuralNetTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/NeuralNetTestCase.java index 5229485c8f9..b299c7fa299 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/NeuralNetTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/NeuralNetTestCase.java @@ -6,14 +6,11 @@ import org.junit.Test; import java.io.IOException; -import com.yahoo.component.ComponentId; - public class NeuralNetTestCase extends AbstractExportingTestCase { @Test public void testNeuralNet() throws IOException, ParseException { - ComponentId.resetGlobalCountersForTests(); - DerivedConfiguration c = assertCorrectDeriving("neuralnet"); + assertCorrectDeriving("neuralnet"); } } |