Search in sources :

Example 1 with DocumentDatabase

use of com.yahoo.vespa.model.search.DocumentDatabase in project vespa by vespa-engine.

the class RankSetupValidator method validate.

@Override
public void validate(VespaModel model, DeployState deployState) {
    try {
        File cfgDir = Files.createTempDirectory("deploy_ranksetup").toFile();
        for (AbstractSearchCluster cluster : model.getSearchClusters()) {
            // Skipping rank expression checking for streaming clusters, not implemented yet
            if (cluster.isRealtime()) {
                IndexedSearchCluster sc = (IndexedSearchCluster) cluster;
                String clusterDir = cfgDir.getAbsolutePath() + "/" + sc.getClusterName() + "/";
                for (DocumentDatabase docDb : sc.getDocumentDbs()) {
                    final String name = docDb.getDerivedConfiguration().getSearch().getName();
                    String searchDir = clusterDir + name + "/";
                    writeConfigs(searchDir, docDb);
                    if (!validate("dir:" + searchDir, sc, name, deployState.getDeployLogger(), cfgDir)) {
                        return;
                    }
                }
            }
        }
        deleteTempDir(cfgDir);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
Also used : IndexedSearchCluster(com.yahoo.vespa.model.search.IndexedSearchCluster) AbstractSearchCluster(com.yahoo.vespa.model.search.AbstractSearchCluster) IOException(java.io.IOException) File(java.io.File) DocumentDatabase(com.yahoo.vespa.model.search.DocumentDatabase)

Example 2 with DocumentDatabase

use of com.yahoo.vespa.model.search.DocumentDatabase in project vespa by vespa-engine.

the class IndexedSearchClusterChangeValidator method validateDocumentDatabases.

private static List<ConfigChangeAction> validateDocumentDatabases(ContentCluster currentCluster, ContentCluster nextCluster, ValidationOverrides overrides, Instant now) {
    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()) {
            result.addAll(validateDocumentDatabase(currentCluster, nextCluster, docTypeName, currentDb, nextDb.get(), overrides, now));
        }
    }
    return result;
}
Also used : ConfigChangeAction(com.yahoo.config.model.api.ConfigChangeAction) java.util(java.util) Instant(java.time.Instant) DocumentDatabaseChangeValidator(com.yahoo.vespa.model.application.validation.change.search.DocumentDatabaseChangeValidator) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Collectors(java.util.stream.Collectors) IndexedSearchCluster(com.yahoo.vespa.model.search.IndexedSearchCluster) VespaModel(com.yahoo.vespa.model.VespaModel) ValidationOverrides(com.yahoo.config.application.api.ValidationOverrides) ContentSearchCluster(com.yahoo.vespa.model.content.ContentSearchCluster) NewDocumentType(com.yahoo.documentmodel.NewDocumentType) DocumentDatabase(com.yahoo.vespa.model.search.DocumentDatabase) ServiceInfo(com.yahoo.config.model.api.ServiceInfo) ConfigChangeAction(com.yahoo.config.model.api.ConfigChangeAction) DocumentDatabase(com.yahoo.vespa.model.search.DocumentDatabase)

Example 3 with DocumentDatabase

use of com.yahoo.vespa.model.search.DocumentDatabase in project vespa by vespa-engine.

the class NoPrefixForIndexes method validate.

@Override
public void validate(VespaModel model, DeployState deployState) {
    for (AbstractSearchCluster cluster : model.getSearchClusters()) {
        if (cluster instanceof IndexedSearchCluster) {
            IndexedSearchCluster sc = (IndexedSearchCluster) cluster;
            for (DocumentDatabase docDb : sc.getDocumentDbs()) {
                DerivedConfiguration sdConfig = docDb.getDerivedConfiguration();
                Search search = sdConfig.getSearch();
                for (SDField field : search.allConcreteFields()) {
                    if (field.doesIndexing()) {
                        // if (!field.getIndexTo().isEmpty() && !field.getIndexTo().contains(field.getName())) continue;
                        if (field.getMatching().getAlgorithm().equals(Matching.Algorithm.PREFIX)) {
                            failField(search, field);
                        }
                        for (Map.Entry<String, Index> e : field.getIndices().entrySet()) {
                            if (e.getValue().isPrefix()) {
                                failField(search, field);
                            }
                        }
                    }
                }
            }
        }
    }
}
Also used : IndexedSearchCluster(com.yahoo.vespa.model.search.IndexedSearchCluster) DerivedConfiguration(com.yahoo.searchdefinition.derived.DerivedConfiguration) SDField(com.yahoo.searchdefinition.document.SDField) AbstractSearchCluster(com.yahoo.vespa.model.search.AbstractSearchCluster) Search(com.yahoo.searchdefinition.Search) Index(com.yahoo.searchdefinition.Index) DocumentDatabase(com.yahoo.vespa.model.search.DocumentDatabase) Map(java.util.Map)

Aggregations

DocumentDatabase (com.yahoo.vespa.model.search.DocumentDatabase)3 IndexedSearchCluster (com.yahoo.vespa.model.search.IndexedSearchCluster)3 AbstractSearchCluster (com.yahoo.vespa.model.search.AbstractSearchCluster)2 ValidationOverrides (com.yahoo.config.application.api.ValidationOverrides)1 ConfigChangeAction (com.yahoo.config.model.api.ConfigChangeAction)1 ServiceInfo (com.yahoo.config.model.api.ServiceInfo)1 NewDocumentType (com.yahoo.documentmodel.NewDocumentType)1 Index (com.yahoo.searchdefinition.Index)1 Search (com.yahoo.searchdefinition.Search)1 DerivedConfiguration (com.yahoo.searchdefinition.derived.DerivedConfiguration)1 SDField (com.yahoo.searchdefinition.document.SDField)1 VespaModel (com.yahoo.vespa.model.VespaModel)1 DocumentDatabaseChangeValidator (com.yahoo.vespa.model.application.validation.change.search.DocumentDatabaseChangeValidator)1 ContentSearchCluster (com.yahoo.vespa.model.content.ContentSearchCluster)1 ContentCluster (com.yahoo.vespa.model.content.cluster.ContentCluster)1 File (java.io.File)1 IOException (java.io.IOException)1 Instant (java.time.Instant)1 java.util (java.util)1 Map (java.util.Map)1