aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com/yahoo/searchdefinition/derived
diff options
context:
space:
mode:
Diffstat (limited to 'config-model/src/main/java/com/yahoo/searchdefinition/derived')
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/derived/Deriver.java31
-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
3 files changed, 25 insertions, 26 deletions
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..bcdc9e656e1 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
@@ -2,7 +2,7 @@
package com.yahoo.searchdefinition.derived;
import com.yahoo.document.config.DocumenttypesConfig;
import com.yahoo.document.config.DocumentmanagerConfig;
-import com.yahoo.searchdefinition.SchemaBuilder;
+import com.yahoo.searchdefinition.ApplicationBuilder;
import com.yahoo.searchdefinition.parser.ParseException;
import com.yahoo.vespa.configmodel.producers.DocumentManager;
import com.yahoo.vespa.configmodel.producers.DocumentTypes;
@@ -11,22 +11,21 @@ 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) {
- SchemaBuilder builder = new SchemaBuilder();
+ public static ApplicationBuilder getSchemaBuilder(List<String> schemas) {
+ ApplicationBuilder builder = new ApplicationBuilder();
try {
- for (String s : sds) {
- builder.importFile(s);
- }
+ for (String schema : schemas)
+ builder.addSchemaFile(schema);
} catch (ParseException | IOException e) {
throw new IllegalArgumentException(e);
}
- builder.build();
+ builder.build(true);
return builder;
}
@@ -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)) {