aboutsummaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2024-03-14 19:05:47 +0100
committerHenning Baldersheim <balder@yahoo-inc.com>2024-03-14 19:05:47 +0100
commit7d13919a778396ecd89837f99776bb2434c1e69a (patch)
tree4f14b32e2186dc4767ea02a4af0ad7540107c804 /config-model
parentdbdb08ce9d30b474e12ce624400230c2d3cec4bc (diff)
Iterate the schema when that is what you need
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/VespaModel.java8
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/application/validation/NoPrefixForIndexes.java10
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/IndexedSearchClusterChangeValidator.java25
3 files changed, 19 insertions, 24 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/VespaModel.java b/config-model/src/main/java/com/yahoo/vespa/model/VespaModel.java
index a109fb9b9dc..e76e40f2235 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/VespaModel.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/VespaModel.java
@@ -36,6 +36,7 @@ import com.yahoo.schema.RankProfile;
import com.yahoo.schema.RankProfileRegistry;
import com.yahoo.schema.derived.AttributeFields;
import com.yahoo.schema.derived.RankProfileList;
+import com.yahoo.schema.derived.SchemaInfo;
import com.yahoo.schema.document.SDField;
import com.yahoo.schema.processing.Processing;
import com.yahoo.vespa.config.ConfigDefinitionKey;
@@ -208,12 +209,11 @@ public final class VespaModel extends AbstractConfigProducerRoot implements Mode
Set<String> typesWithIndexedFields = content.getSearch().getIndexed() == null
? Set.of()
- : content.getSearch().getIndexed().getDocumentDbs().stream()
- .filter(database -> database.getDerivedConfiguration()
- .getSchema()
+ : content.getSearch().getIndexed().schemas().values().stream()
+ .filter(schemaInfo -> schemaInfo.fullSchema()
.allConcreteFields()
.stream().anyMatch(SDField::doesIndexing))
- .map(DocumentDatabase::getSchemaName)
+ .map(SchemaInfo::name)
.collect(Collectors.toCollection(LinkedHashSet::new));
return typesWithIndexMode.stream().filter(typesWithIndexedFields::contains)
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 2ea4755ca75..bee61c9c3cf 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
@@ -3,11 +3,10 @@ package com.yahoo.vespa.model.application.validation;
import com.yahoo.schema.Index;
import com.yahoo.schema.Schema;
-import com.yahoo.schema.derived.DerivedConfiguration;
+import com.yahoo.schema.derived.SchemaInfo;
import com.yahoo.schema.document.ImmutableSDField;
import com.yahoo.schema.document.MatchAlgorithm;
import com.yahoo.vespa.model.application.validation.Validation.Context;
-import com.yahoo.vespa.model.search.DocumentDatabase;
import com.yahoo.vespa.model.search.SearchCluster;
import java.util.Map;
@@ -22,10 +21,9 @@ public class NoPrefixForIndexes implements Validator {
@Override
public void validate(Context context) {
for (SearchCluster cluster : context.model().getSearchClusters()) {
- for (DocumentDatabase docDb : cluster.getDocumentDbs()) {
- DerivedConfiguration sdConfig = docDb.getDerivedConfiguration();
- if ( ! sdConfig.isStreaming() ) {
- Schema schema = sdConfig.getSchema();
+ for (SchemaInfo schemaInfo : cluster.schemas().values()) {
+ if ( schemaInfo.getIndexMode() == SchemaInfo.IndexMode.INDEX ) {
+ Schema schema = schemaInfo.fullSchema();
for (ImmutableSDField field : schema.allConcreteFields()) {
if (field.doesIndexing()) {
//if (!field.getIndexTo().isEmpty() && !field.getIndexTo().contains(field.getName())) continue;
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/IndexedSearchClusterChangeValidator.java b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/IndexedSearchClusterChangeValidator.java
index f4477bdb141..5117fb7272c 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/IndexedSearchClusterChangeValidator.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/IndexedSearchClusterChangeValidator.java
@@ -16,7 +16,6 @@ import com.yahoo.vespa.model.search.IndexedSearchCluster;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import java.util.Optional;
import java.util.stream.Collectors;
/**
@@ -38,21 +37,22 @@ public class IndexedSearchClusterChangeValidator implements ChangeValidator {
private static List<ConfigChangeAction> validateContentCluster(ContentCluster currentCluster,
ContentCluster nextCluster,
- DeployState deployState) {
+ DeployState deployState)
+ {
return validateDocumentDatabases(currentCluster, nextCluster, deployState);
}
private static List<ConfigChangeAction> validateDocumentDatabases(ContentCluster currentCluster,
ContentCluster nextCluster,
- DeployState deployState) {
+ DeployState deployState)
+ {
List<ConfigChangeAction> result = new ArrayList<>();
for (DocumentDatabase currentDb : getDocumentDbs(currentCluster.getSearch())) {
String docTypeName = currentDb.getName();
- Optional<DocumentDatabase> nextDb = nextCluster.getSearch().getIndexed().getDocumentDbs().stream().
- filter(db -> db.getName().equals(docTypeName)).findFirst();
- if (nextDb.isPresent()) {
+ var nextDb = nextCluster.getSearch().getIndexed().getDocumentDB(docTypeName);
+ if (nextDb != null) {
result.addAll(validateDocumentDatabase(currentCluster, nextCluster, docTypeName,
- currentDb, nextDb.get(), deployState));
+ currentDb, nextDb, deployState));
}
}
return result;
@@ -63,16 +63,13 @@ public class IndexedSearchClusterChangeValidator implements ChangeValidator {
String docTypeName,
DocumentDatabase currentDb,
DocumentDatabase nextDb,
- DeployState deployState) {
+ DeployState deployState)
+ {
NewDocumentType currentDocType = currentCluster.getDocumentDefinitions().get(docTypeName);
NewDocumentType nextDocType = nextCluster.getDocumentDefinitions().get(docTypeName);
List<VespaConfigChangeAction> result =
- new DocumentDatabaseChangeValidator(currentCluster.id(),
- currentDb,
- currentDocType,
- nextDb,
- nextDocType,
- deployState).validate();
+ new DocumentDatabaseChangeValidator(currentCluster.id(), currentDb, currentDocType,
+ nextDb, nextDocType, deployState).validate();
return modifyActions(result, getSearchNodeServices(nextCluster.getSearch().getIndexed()), docTypeName);
}