summaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com/yahoo
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2022-01-24 15:37:52 +0100
committerJon Bratseth <bratseth@gmail.com>2022-01-24 15:37:52 +0100
commita22135f0b5a9f2149b6c67c70fc6cf197e5c7d98 (patch)
tree0501417991ec368e1c2fce61460db47ed6933f83 /config-model/src/main/java/com/yahoo
parent7353d2de240ec0566bd3a2b7d27cf540077fee2a (diff)
Cleanup: No functional changes
Diffstat (limited to 'config-model/src/main/java/com/yahoo')
-rw-r--r--config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java1
-rw-r--r--config-model/src/main/java/com/yahoo/config/model/deploy/SearchDocumentModel.java12
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/DefaultRankProfile.java8
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/RankProfile.java85
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/RankProfileRegistry.java15
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/Schema.java1
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/derived/Deriver.java25
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/derived/RankProfileList.java10
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/derived/RawRankProfile.java10
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/expressiontransforms/OnnxModelTransformer.java4
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/processing/DiversitySettingsValidator.java2
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/processing/FilterFieldNames.java2
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/processing/MatchPhaseSettingsValidator.java2
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/processing/RankingExpressionTypeResolver.java8
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/processing/ReservedFunctionNames.java6
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/documentmodel/DocumentModel.java9
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/ml/ConvertedModel.java2
17 files changed, 96 insertions, 106 deletions
diff --git a/config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java b/config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java
index bb8c4141873..43b008ddab6 100644
--- a/config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java
+++ b/config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java
@@ -470,6 +470,7 @@ public class DeployState implements ConfigDefinitionStore {
reindexing);
}
+ // TODO: This should be moved into Application+SchemaBuilder
private SearchDocumentModel createSearchDocumentModel(RankProfileRegistry rankProfileRegistry,
QueryProfiles queryProfiles,
ValidationParameters validationParameters) {
diff --git a/config-model/src/main/java/com/yahoo/config/model/deploy/SearchDocumentModel.java b/config-model/src/main/java/com/yahoo/config/model/deploy/SearchDocumentModel.java
index aaba9a2b98c..ece3a662d94 100644
--- a/config-model/src/main/java/com/yahoo/config/model/deploy/SearchDocumentModel.java
+++ b/config-model/src/main/java/com/yahoo/config/model/deploy/SearchDocumentModel.java
@@ -11,10 +11,11 @@ import java.util.List;
import java.util.Map;
/**
- * Internal helper class to retrieve document model and search definitions.
+ * Internal helper class to retrieve document model and schemas.
*
* @author Ulf Lilleengen
*/
+// TODO: This should be removed in favor of Application
public class SearchDocumentModel {
private final DocumentModel documentModel;
@@ -23,7 +24,6 @@ public class SearchDocumentModel {
public SearchDocumentModel(DocumentModel documentModel, List<NamedSchema> schemas) {
this.documentModel = documentModel;
this.schemas = schemas;
-
}
public DocumentModel getDocumentModel() {
@@ -42,12 +42,4 @@ public class SearchDocumentModel {
return new SearchDocumentModel(builder.getModel(), ret);
}
- public static SearchDocumentModel fromBuilder(SchemaBuilder builder) {
- List<NamedSchema> ret = new ArrayList<>();
- for (Schema schema : builder.getSchemaList()) {
- ret.add(new NamedSchema(schema.getName(), schema));
- }
- return new SearchDocumentModel(builder.getModel(), ret);
- }
-
}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/DefaultRankProfile.java b/config-model/src/main/java/com/yahoo/searchdefinition/DefaultRankProfile.java
index 56a739ced8b..4444636fbe8 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/DefaultRankProfile.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/DefaultRankProfile.java
@@ -40,14 +40,14 @@ public class DefaultRankProfile extends RankProfile {
RankSetting setting = super.getRankSetting(fieldOrIndex,type);
if (setting != null) return setting;
- ImmutableSDField field = getSearch().getConcreteField(fieldOrIndex);
+ ImmutableSDField field = schema().getConcreteField(fieldOrIndex);
if (field != null) {
setting = toRankSetting(field,type);
if (setting != null)
return setting;
}
- Index index = getSearch().getIndex(fieldOrIndex);
+ Index index = schema().getIndex(fieldOrIndex);
if (index != null) {
setting = toRankSetting(index,type);
if (setting != null)
@@ -89,7 +89,7 @@ public class DefaultRankProfile extends RankProfile {
public Set<RankSetting> rankSettings() {
Set<RankSetting> settings = new LinkedHashSet<>(20);
settings.addAll(this.rankSettings);
- for (ImmutableSDField field : getSearch().allConcreteFields() ) {
+ for (ImmutableSDField field : schema().allConcreteFields() ) {
addSetting(field, RankSetting.Type.WEIGHT, settings);
addSetting(field, RankSetting.Type.RANKTYPE, settings);
addSetting(field, RankSetting.Type.LITERALBOOST, settings);
@@ -97,7 +97,7 @@ public class DefaultRankProfile extends RankProfile {
}
// Foer settings that really pertains to indexes do the explicit indexes too
- for (Index index : getSearch().getExplicitIndices()) {
+ for (Index index : schema().getExplicitIndices()) {
addSetting(index, RankSetting.Type.PREFERBITVECTOR, settings);
}
return settings;
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/RankProfile.java b/config-model/src/main/java/com/yahoo/searchdefinition/RankProfile.java
index 5f6bde3b791..20234862643 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/RankProfile.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/RankProfile.java
@@ -57,11 +57,12 @@ public class RankProfile implements Cloneable {
public final static String FIRST_PHASE = "firstphase";
public final static String SECOND_PHASE = "secondphase";
+
/** The search definition-unique name of this rank profile */
private final String name;
- /** The search definition owning this profile, or null if global (owned by a model) */
- private final ImmutableSchema search;
+ /** The schema owning this profile, or null if global (owned by a model) */
+ private final ImmutableSchema schema;
/** The name of the rank profile inherited by this */
private String inheritedName = null;
@@ -132,20 +133,6 @@ public class RankProfile implements Cloneable {
private final ApplicationPackage applicationPackage;
private final DeployLogger deployLogger;
- private static class CachedFunctions {
- private final Map<String, RankingExpressionFunction> allRankingExpressionFunctions;
- private final ImmutableMap<String, ExpressionFunction> allExpressionFunctions;
- CachedFunctions(Map<String, RankingExpressionFunction> functions) {
- allRankingExpressionFunctions = functions;
- ImmutableMap.Builder<String,ExpressionFunction> mapBuilder = new ImmutableMap.Builder<>();
- for (var entry : functions.entrySet()) {
- ExpressionFunction function = entry.getValue().function();
- mapBuilder.put(function.getName(), function);
- }
- allExpressionFunctions = mapBuilder.build();
- }
- }
-
/**
* Creates a new rank profile for a particular search definition
*
@@ -156,7 +143,7 @@ public class RankProfile implements Cloneable {
*/
public RankProfile(String name, Schema schema, RankProfileRegistry rankProfileRegistry, RankingConstants rankingConstants) {
this.name = Objects.requireNonNull(name, "name cannot be null");
- this.search = Objects.requireNonNull(schema, "search cannot be null");
+ this.schema = Objects.requireNonNull(schema, "search cannot be null");
this.onnxModels = null;
this.rankingConstants = rankingConstants;
this.rankProfileRegistry = rankProfileRegistry;
@@ -172,7 +159,7 @@ public class RankProfile implements Cloneable {
public RankProfile(String name, ApplicationPackage applicationPackage, DeployLogger deployLogger,
RankProfileRegistry rankProfileRegistry, RankingConstants rankingConstants, OnnxModels onnxModels) {
this.name = Objects.requireNonNull(name, "name cannot be null");
- this.search = null;
+ this.schema = null;
this.rankProfileRegistry = rankProfileRegistry;
this.rankingConstants = rankingConstants;
this.onnxModels = onnxModels;
@@ -180,10 +167,10 @@ public class RankProfile implements Cloneable {
this.deployLogger = deployLogger;
}
- public String getName() { return name; }
+ public String name() { return name; }
/** Returns the search definition owning this, or null if it is global */
- public ImmutableSchema getSearch() { return search; }
+ public ImmutableSchema schema() { return schema; }
/** Returns the application this is part of */
public ApplicationPackage applicationPackage() {
@@ -196,19 +183,19 @@ public class RankProfile implements Cloneable {
}
public Map<String, OnnxModel> onnxModels() {
- return search != null ? search.onnxModels().asMap() : onnxModels.asMap();
+ return schema != null ? schema.onnxModels().asMap() : onnxModels.asMap();
}
private Stream<ImmutableSDField> allFields() {
- if (search == null) return Stream.empty();
+ if (schema == null) return Stream.empty();
if (allFieldsList == null) {
- allFieldsList = search.allFieldsList();
+ allFieldsList = schema.allFieldsList();
}
return allFieldsList.stream();
}
private Stream<ImmutableSDField> allImportedFields() {
- return search != null ? search.allImportedFields() : Stream.empty();
+ return schema != null ? schema.allImportedFields() : Stream.empty();
}
/**
@@ -228,9 +215,9 @@ public class RankProfile implements Cloneable {
if (inherited == null) {
inherited = resolveInherited();
if (inherited == null) {
- String msg = "rank-profile '" + getName() + "' inherits '" + inheritedName +
- "', but it does not exist anywhere in the inheritance of search '" +
- ((getSearch() != null) ? getSearch().getName() : " global rank profiles") + "'.";
+ String msg = "rank-profile '" + name() + "' inherits '" + inheritedName +
+ "', but it does not exist anywhere in the inheritance of search '" +
+ ((schema() != null) ? schema().getName() : " global rank profiles") + "'.";
throw new IllegalArgumentException(msg);
} else {
List<String> children = new ArrayList<>();
@@ -242,9 +229,9 @@ public class RankProfile implements Cloneable {
}
private String createFullyQualifiedName() {
- return (search != null)
- ? (search.getName() + "." + getName())
- : getName();
+ return (schema != null)
+ ? (schema.getName() + "." + name())
+ : name();
}
private void verifyNoInheritanceCycle(List<String> children, RankProfile parent) {
@@ -275,8 +262,8 @@ public class RankProfile implements Cloneable {
private RankProfile resolveInherited() {
if (inheritedName == null) return null;
- return (getSearch() != null)
- ? resolveInherited(search)
+ return (schema() != null)
+ ? resolveInherited(schema)
: rankProfileRegistry.getGlobal(inheritedName);
}
@@ -289,7 +276,7 @@ public class RankProfile implements Cloneable {
public boolean inherits(String name) {
RankProfile parent = getInherited();
while (parent != null) {
- if (parent.getName().equals(name))
+ if (parent.name().equals(name))
return true;
parent = parent.getInherited();
}
@@ -619,7 +606,7 @@ public class RankProfile implements Cloneable {
@Override
public String toString() {
- return "rank profile '" + getName() + "'";
+ return "rank profile '" + name() + "'";
}
public int getRerankCount() {
@@ -819,14 +806,14 @@ public class RankProfile implements Cloneable {
private ExpressionFunction parseRankingExpression(String name, List<String> arguments, String expression) throws ParseException {
if (expression.trim().length() == 0)
- throw new ParseException("Encountered an empty ranking expression in " + getName()+ ", " + name + ".");
+ throw new ParseException("Encountered an empty ranking expression in " + name() + ", " + name + ".");
try (Reader rankingExpressionReader = openRankingExpressionReader(name, expression.trim())) {
return new ExpressionFunction(name, arguments, new RankingExpression(name, rankingExpressionReader));
}
catch (com.yahoo.searchlib.rankingexpression.parser.ParseException e) {
ParseException exception = new ParseException("Could not parse ranking expression '" + expression.trim() +
- "' in " + getName()+ ", " + name + ".");
+ "' in " + name() + ", " + name + ".");
throw (ParseException)exception.initCause(e);
}
catch (IOException e) {
@@ -848,10 +835,10 @@ public class RankProfile implements Cloneable {
String fileName = extractFileName(expression);
File file = new File(fileName);
if (!file.isAbsolute() && file.getPath().contains("/")) // See ticket 4102122
- throw new IllegalArgumentException("In " + getName() + ", " + expName + ", ranking references file '" + file +
- "' in subdirectory, which is not supported.");
+ throw new IllegalArgumentException("In " + name() + ", " + expName + ", ranking references file '" + file +
+ "' in subdirectory, which is not supported.");
- return search.getRankingExpression(fileName);
+ return schema.getRankingExpression(fileName);
}
/** Shallow clones this */
@@ -888,7 +875,7 @@ public class RankProfile implements Cloneable {
return compiled;
}
catch (IllegalArgumentException e) {
- throw new IllegalArgumentException("Rank profile '" + getName() + "' is invalid", e);
+ throw new IllegalArgumentException("Rank profile '" + name() + "' is invalid", e);
}
}
@@ -1321,4 +1308,22 @@ public class RankProfile implements Cloneable {
}
+ private static class CachedFunctions {
+
+ private final Map<String, RankingExpressionFunction> allRankingExpressionFunctions;
+
+ private final ImmutableMap<String, ExpressionFunction> allExpressionFunctions;
+
+ CachedFunctions(Map<String, RankingExpressionFunction> functions) {
+ allRankingExpressionFunctions = functions;
+ ImmutableMap.Builder<String,ExpressionFunction> mapBuilder = new ImmutableMap.Builder<>();
+ for (var entry : functions.entrySet()) {
+ ExpressionFunction function = entry.getValue().function();
+ mapBuilder.put(function.getName(), function);
+ }
+ allExpressionFunctions = mapBuilder.build();
+ }
+
+ }
+
}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/RankProfileRegistry.java b/config-model/src/main/java/com/yahoo/searchdefinition/RankProfileRegistry.java
index 08ae3d838ec..75c3aa313c0 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/RankProfileRegistry.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/RankProfileRegistry.java
@@ -6,7 +6,6 @@ import com.yahoo.searchdefinition.document.SDDocumentType;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
-import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
@@ -44,22 +43,22 @@ public class RankProfileRegistry {
/** Adds a rank profile to this registry */
public void add(RankProfile rankProfile) {
- String searchName = extractName(rankProfile.getSearch());
- if ( ! rankProfiles.containsKey(searchName)) {
- rankProfiles.put(searchName, new LinkedHashMap<>());
+ String schemaName = extractName(rankProfile.schema());
+ if ( ! rankProfiles.containsKey(schemaName)) {
+ rankProfiles.put(schemaName, new LinkedHashMap<>());
}
checkForDuplicate(rankProfile);
- rankProfiles.get(searchName).put(rankProfile.getName(), rankProfile);
+ rankProfiles.get(schemaName).put(rankProfile.name(), rankProfile);
}
private void checkForDuplicate(RankProfile rankProfile) {
- String rankProfileName = rankProfile.getName();
- RankProfile existingRankProfileWithSameName = rankProfiles.get(extractName(rankProfile.getSearch())).get(rankProfileName);
+ String rankProfileName = rankProfile.name();
+ RankProfile existingRankProfileWithSameName = rankProfiles.get(extractName(rankProfile.schema())).get(rankProfileName);
if (existingRankProfileWithSameName == null) return;
if ( ! overridableRankProfileNames.contains(rankProfileName)) {
throw new IllegalArgumentException("Duplicate rank profile '" + rankProfileName + "' in " +
- rankProfile.getSearch());
+ rankProfile.schema());
}
}
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 ddad67324ba..dec0a061b21 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/Schema.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/Schema.java
@@ -124,6 +124,7 @@ public class Schema implements ImmutableSchema {
DeployLogger deployLogger,
ModelContext.Properties properties) {
this(inherited, application, fileRegistry, deployLogger, properties, false);
+ if (1==1) throw new RuntimeException("df");
this.name = name;
}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/derived/Deriver.java b/config-model/src/main/java/com/yahoo/searchdefinition/derived/Deriver.java
index 14e303522e0..b1fe4942f4a 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/derived/Deriver.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/derived/Deriver.java
@@ -11,18 +11,17 @@ import java.util.Collections;
import java.util.List;
/**
- * Auxiliary facade for deriving configs from search definitions
+ * Facade for deriving configs from schemas
*
* @author bratseth
*/
public class Deriver {
- public static SchemaBuilder getSearchBuilder(List<String> sds) {
+ public static SchemaBuilder getSchemaBuilder(List<String> schemas) {
SchemaBuilder builder = new SchemaBuilder();
try {
- for (String s : sds) {
- builder.importFile(s);
- }
+ for (String schema : schemas)
+ builder.importFile(schema);
} catch (ParseException | IOException e) {
throw new IllegalArgumentException(e);
}
@@ -34,22 +33,22 @@ public class Deriver {
return getDocumentManagerConfig(Collections.singletonList(sd));
}
- public static DocumentmanagerConfig.Builder getDocumentManagerConfig(List<String> sds) {
- return new DocumentManager().produce(getSearchBuilder(sds).getModel(), new DocumentmanagerConfig.Builder());
+ public static DocumentmanagerConfig.Builder getDocumentManagerConfig(List<String> schemas) {
+ return new DocumentManager().produce(getSchemaBuilder(schemas).getModel(), new DocumentmanagerConfig.Builder());
}
- public static DocumentmanagerConfig.Builder getDocumentManagerConfig(List<String> sds, boolean useV8DocManagerCfg) {
+ public static DocumentmanagerConfig.Builder getDocumentManagerConfig(List<String> schemas, boolean useV8DocManagerCfg) {
return new DocumentManager()
.useV8DocManagerCfg(useV8DocManagerCfg)
- .produce(getSearchBuilder(sds).getModel(), new DocumentmanagerConfig.Builder());
+ .produce(getSchemaBuilder(schemas).getModel(), new DocumentmanagerConfig.Builder());
}
- public static DocumenttypesConfig.Builder getDocumentTypesConfig(String sd) {
- return getDocumentTypesConfig(Collections.singletonList(sd));
+ public static DocumenttypesConfig.Builder getDocumentTypesConfig(String schema) {
+ return getDocumentTypesConfig(Collections.singletonList(schema));
}
- public static DocumenttypesConfig.Builder getDocumentTypesConfig(List<String> sds) {
- return new DocumentTypes().produce(getSearchBuilder(sds).getModel(), new DocumenttypesConfig.Builder());
+ public static DocumenttypesConfig.Builder getDocumentTypesConfig(List<String> schemas) {
+ return new DocumentTypes().produce(getSchemaBuilder(schemas).getModel(), new DocumenttypesConfig.Builder());
}
}
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 3081637c975..86c1d478974 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
@@ -75,7 +75,7 @@ public class RankProfileList extends Derived implements RankProfilesConfig.Produ
private boolean areDependenciesReady(RankProfile rank, RankProfileRegistry registry) {
return (rank.getInheritedName() == null) ||
rankProfiles.containsKey(rank.getInheritedName()) ||
- (rank.getSearch() != null && registry.resolve(rank.getSearch().getDocument(), rank.getInheritedName()) != null);
+ (rank.schema() != null && registry.resolve(rank.schema().getDocument(), rank.getInheritedName()) != null);
}
private void deriveRankProfiles(RankProfileRegistry rankProfileRegistry,
@@ -92,7 +92,7 @@ public class RankProfileList extends Derived implements RankProfilesConfig.Produ
}
Map<String, RankProfile> remaining = new LinkedHashMap<>();
- rankProfileRegistry.rankProfilesOf(schema).forEach(rank -> remaining.put(rank.getName(), rank));
+ rankProfileRegistry.rankProfilesOf(schema).forEach(rank -> remaining.put(rank.name(), rank));
remaining.remove("default");
while (!remaining.isEmpty()) {
List<RankProfile> ready = new ArrayList<>();
@@ -100,7 +100,7 @@ public class RankProfileList extends Derived implements RankProfilesConfig.Produ
if (areDependenciesReady(rank, rankProfileRegistry)) ready.add(rank);
});
processRankProfiles(ready, queryProfiles, importedModels, schema, attributeFields, deployProperties, executor);
- ready.forEach(rank -> remaining.remove(rank.getName()));
+ ready.forEach(rank -> remaining.remove(rank.name()));
}
}
private void processRankProfiles(List<RankProfile> ready,
@@ -116,8 +116,8 @@ public class RankProfileList extends Derived implements RankProfilesConfig.Produ
onnxModels.add(rank.onnxModels());
}
- futureRawRankProfiles.put(rank.getName(), executor.submit(() -> new RawRankProfile(rank, largeRankExpressions, queryProfiles, importedModels,
- attributeFields, deployProperties)));
+ futureRawRankProfiles.put(rank.name(), executor.submit(() -> new RawRankProfile(rank, largeRankExpressions, queryProfiles, importedModels,
+ attributeFields, deployProperties)));
}
try {
for (Future<RawRankProfile> rawFuture : futureRawRankProfiles.values()) {
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/derived/RawRankProfile.java b/config-model/src/main/java/com/yahoo/searchdefinition/derived/RawRankProfile.java
index f775c4e697d..a64f0939677 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/derived/RawRankProfile.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/derived/RawRankProfile.java
@@ -62,7 +62,7 @@ public class RawRankProfile implements RankProfilesConfig.Producer {
public RawRankProfile(RankProfile rankProfile, LargeRankExpressions largeExpressions,
QueryProfileRegistry queryProfiles, ImportedMlModels importedModels,
AttributeFields attributeFields, ModelContext.Properties deployProperties) {
- this.name = rankProfile.getName();
+ this.name = rankProfile.name();
compressedProperties = compress(new Deriver(rankProfile.compile(queryProfiles, importedModels),
attributeFields, deployProperties).derive(largeExpressions));
}
@@ -158,7 +158,7 @@ public class RawRankProfile implements RankProfilesConfig.Producer {
*/
Deriver(RankProfile compiled, AttributeFields attributeFields, ModelContext.Properties deployProperties)
{
- rankprofileName = compiled.getName();
+ rankprofileName = compiled.name();
attributeTypes = compiled.getAttributeTypes();
queryFeatureTypes = compiled.getQueryFeatureTypes();
firstPhaseRanking = compiled.getFirstPhaseRanking();
@@ -447,8 +447,8 @@ public class RawRankProfile implements RankProfilesConfig.Producer {
}
private void deriveOnnxModelFunctionsAndFeatures(RankProfile rankProfile) {
- if (rankProfile.getSearch() == null) return;
- if (rankProfile.getSearch().onnxModels().asMap().isEmpty()) return;
+ if (rankProfile.schema() == null) return;
+ if (rankProfile.schema().onnxModels().asMap().isEmpty()) return;
replaceOnnxFunctionInputs(rankProfile);
replaceImplicitOnnxConfigFeatures(summaryFeatures, rankProfile);
replaceImplicitOnnxConfigFeatures(matchFeatures, rankProfile);
@@ -457,7 +457,7 @@ public class RawRankProfile implements RankProfilesConfig.Producer {
private void replaceOnnxFunctionInputs(RankProfile rankProfile) {
Set<String> functionNames = rankProfile.getFunctions().keySet();
if (functionNames.isEmpty()) return;
- for (OnnxModel onnxModel: rankProfile.getSearch().onnxModels().asMap().values()) {
+ for (OnnxModel onnxModel: rankProfile.schema().onnxModels().asMap().values()) {
for (Map.Entry<String, String> mapping : onnxModel.getInputMap().entrySet()) {
String source = mapping.getValue();
if (functionNames.contains(source)) {
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/expressiontransforms/OnnxModelTransformer.java b/config-model/src/main/java/com/yahoo/searchdefinition/expressiontransforms/OnnxModelTransformer.java
index 6d9f4cdec92..35ee9ddb9ed 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/expressiontransforms/OnnxModelTransformer.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/expressiontransforms/OnnxModelTransformer.java
@@ -49,12 +49,12 @@ public class OnnxModelTransformer extends ExpressionTransformer<RankProfileTrans
private ExpressionNode transformFeature(ReferenceNode feature, RankProfileTransformContext context) {
if (context.rankProfile() == null) return feature;
- if (context.rankProfile().getSearch() == null) return feature;
+ if (context.rankProfile().schema() == null) return feature;
return transformFeature(feature, context.rankProfile());
}
public static ExpressionNode transformFeature(ReferenceNode feature, RankProfile rankProfile) {
- ImmutableSchema search = rankProfile.getSearch();
+ ImmutableSchema search = rankProfile.schema();
final String featureName = feature.getName();
if ( ! featureName.equals("onnxModel") && ! featureName.equals("onnx")) return feature;
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/processing/DiversitySettingsValidator.java b/config-model/src/main/java/com/yahoo/searchdefinition/processing/DiversitySettingsValidator.java
index 5643bb660f1..3759fc453df 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/processing/DiversitySettingsValidator.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/processing/DiversitySettingsValidator.java
@@ -30,7 +30,7 @@ public class DiversitySettingsValidator extends Processor {
}
private void validate(RankProfile rankProfile, RankProfile.DiversitySettings settings) {
String attributeName = settings.getAttribute();
- new AttributeValidator(schema.getName(), rankProfile.getName(),
+ new AttributeValidator(schema.getName(), rankProfile.name(),
schema.getAttribute(attributeName), attributeName).validate();
}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/processing/FilterFieldNames.java b/config-model/src/main/java/com/yahoo/searchdefinition/processing/FilterFieldNames.java
index d89f83c333f..3f97bf83565 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/processing/FilterFieldNames.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/processing/FilterFieldNames.java
@@ -63,7 +63,7 @@ public class FilterFieldNames extends Processor {
filterFields.add(fieldName);
}
} else {
- deployLogger.logApplicationPackage(Level.WARNING, "For rank profile '" + profile.getName() + "': Cannot apply rank filter setting to unexisting field '" + fieldName + "'");
+ deployLogger.logApplicationPackage(Level.WARNING, "For rank profile '" + profile.name() + "': Cannot apply rank filter setting to unexisting field '" + fieldName + "'");
}
}
}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/processing/MatchPhaseSettingsValidator.java b/config-model/src/main/java/com/yahoo/searchdefinition/processing/MatchPhaseSettingsValidator.java
index b697c584ece..4eae6b47833 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/processing/MatchPhaseSettingsValidator.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/processing/MatchPhaseSettingsValidator.java
@@ -35,7 +35,7 @@ public class MatchPhaseSettingsValidator extends Processor {
private void validateMatchPhaseSettings(RankProfile rankProfile, RankProfile.MatchPhaseSettings settings) {
String attributeName = settings.getAttribute();
new AttributeValidator(schema.getName(),
- rankProfile.getName(),
+ rankProfile.name(),
schema.getAttribute(attributeName), attributeName).validate();
}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/processing/RankingExpressionTypeResolver.java b/config-model/src/main/java/com/yahoo/searchdefinition/processing/RankingExpressionTypeResolver.java
index f5c3fa35e34..e6adb8b683b 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/processing/RankingExpressionTypeResolver.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/processing/RankingExpressionTypeResolver.java
@@ -89,10 +89,10 @@ public class RankingExpressionTypeResolver extends Processor {
if ( context.tensorsAreUsed() &&
! context.queryFeaturesNotDeclared().isEmpty() &&
! warnedAbout.containsAll(context.queryFeaturesNotDeclared())) {
- deployLogger.logApplicationPackage(Level.WARNING, "The following query features used in '" + profile.getName() +
- "' are not declared in query profile " +
- "types and will be interpreted as scalars, not tensors: " +
- context.queryFeaturesNotDeclared());
+ deployLogger.logApplicationPackage(Level.WARNING, "The following query features used in '" + profile.name() +
+ "' are not declared in query profile " +
+ "types and will be interpreted as scalars, not tensors: " +
+ context.queryFeaturesNotDeclared());
warnedAbout.addAll(context.queryFeaturesNotDeclared());
}
}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/processing/ReservedFunctionNames.java b/config-model/src/main/java/com/yahoo/searchdefinition/processing/ReservedFunctionNames.java
index 8194b9f9e06..f4f920d9ec8 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/processing/ReservedFunctionNames.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/processing/ReservedFunctionNames.java
@@ -35,9 +35,9 @@ public class ReservedFunctionNames extends Processor {
for (String functionName : rp.getFunctions().keySet()) {
if (reservedNames.contains(functionName)) {
deployLogger.logApplicationPackage(Level.WARNING, "Function '" + functionName + "' " +
- "in rank profile '" + rp.getName() + "' " +
- "has a reserved name. This might mean that the function shadows " +
- "the built-in function with the same name."
+ "in rank profile '" + rp.name() + "' " +
+ "has a reserved name. This might mean that the function shadows " +
+ "the built-in function with the same name."
);
}
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/documentmodel/DocumentModel.java b/config-model/src/main/java/com/yahoo/vespa/documentmodel/DocumentModel.java
index 112385e1801..388109a21af 100644
--- a/config-model/src/main/java/com/yahoo/vespa/documentmodel/DocumentModel.java
+++ b/config-model/src/main/java/com/yahoo/vespa/documentmodel/DocumentModel.java
@@ -11,21 +11,14 @@ import com.yahoo.documentmodel.DocumentTypeRepo;
*
* @author baldersheim
*/
+// TODO: This should be removed in favor of Application
public class DocumentModel {
private final DocumentTypeRepo documentMan = new DocumentTypeRepo();
private final SearchManager searchMan = new SearchManager();
- /**
- *
- * @return Returns the DocumentManager
- */
public DocumentTypeRepo getDocumentManager() { return documentMan; }
- /**
- *
- * @return Returns the SearchManager
- */
public SearchManager getSearchManager() { return searchMan; }
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/ml/ConvertedModel.java b/config-model/src/main/java/com/yahoo/vespa/model/ml/ConvertedModel.java
index 1488f5fd112..38b1d42862e 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/ml/ConvertedModel.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/ml/ConvertedModel.java
@@ -87,7 +87,7 @@ public class ConvertedModel {
ApplicationPackage applicationPackage = context.rankProfile().applicationPackage();
ImportedMlModel sourceModel = // TODO: Convert to name here, make sure its done just one way
context.importedModels().get(sourceModelFile(applicationPackage, modelPath));
- ModelName modelName = new ModelName(context.rankProfile().getName(), modelPath, pathIsFile);
+ ModelName modelName = new ModelName(context.rankProfile().name(), modelPath, pathIsFile);
if (sourceModel == null && ! new ModelStore(applicationPackage, modelName).exists())
throw new IllegalArgumentException("No model '" + modelPath + "' is available. Available models: " +