Search in sources :

Example 1 with IndexedSearchCluster

use of com.yahoo.vespa.model.search.IndexedSearchCluster 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 IndexedSearchCluster

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

the class Content method createTlds.

public void createTlds(ConfigModelRepo modelRepo) {
    IndexedSearchCluster indexedCluster = cluster.getSearch().getIndexed();
    if (indexedCluster == null)
        return;
    SimpleConfigProducer tldParent = new SimpleConfigProducer(indexedCluster, "tlds");
    for (ConfigModel model : modelRepo.asMap().values()) {
        if (!(model instanceof ContainerModel))
            continue;
        ContainerCluster containerCluster = ((ContainerModel) model).getCluster();
        // this is not a qrs cluster
        if (containerCluster.getSearch() == null)
            continue;
        log.log(LogLevel.DEBUG, "Adding tlds for indexed cluster " + indexedCluster.getClusterName() + ", container cluster " + containerCluster.getName());
        indexedCluster.addTldsWithSameIdsAsContainers(tldParent, containerCluster);
    }
    indexedCluster.setupDispatchGroups();
}
Also used : IndexedSearchCluster(com.yahoo.vespa.model.search.IndexedSearchCluster) ConfigModel(com.yahoo.config.model.ConfigModel) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) ContainerModel(com.yahoo.vespa.model.container.ContainerModel)

Example 3 with IndexedSearchCluster

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

the class IndexedTest method requireMultipleDocumentTypes.

@Test
public void requireMultipleDocumentTypes() {
    VespaModelCreatorWithMockPkg creator = getIndexedVespaModelCreator();
    VespaModel model = creator.create();
    DeployState deployState = creator.deployState;
    IndexedSearchCluster cluster = model.getContentClusters().get("test").getSearch().getIndexed();
    assertEquals(3, cluster.getDocumentDbs().size());
    NewDocumentType type1 = deployState.getDocumentModel().getDocumentManager().getDocumentType("type1");
    NewDocumentType type2 = deployState.getDocumentModel().getDocumentManager().getDocumentType("type2");
    NewDocumentType type3 = deployState.getDocumentModel().getDocumentManager().getDocumentType("type3");
    assertNotNull(type1);
    assertNotNull(type2);
    assertNotNull(type3);
}
Also used : IndexedSearchCluster(com.yahoo.vespa.model.search.IndexedSearchCluster) VespaModelCreatorWithMockPkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg) DeployState(com.yahoo.config.model.deploy.DeployState) VespaModel(com.yahoo.vespa.model.VespaModel) NewDocumentType(com.yahoo.documentmodel.NewDocumentType) Test(org.junit.Test)

Example 4 with IndexedSearchCluster

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

the class ClusterTest method requireThatContentSearchIsApplied.

@Test
public void requireThatContentSearchIsApplied() throws ParseException {
    ContentCluster cluster = newContentCluster(joinLines("<search>", "  <query-timeout>1.1</query-timeout>", "  <visibility-delay>2.3</visibility-delay>", "</search>"));
    IndexedSearchCluster searchCluster = cluster.getSearch().getIndexed();
    assertNotNull(searchCluster);
    assertEquals(1.1, searchCluster.getQueryTimeout(), 1E-6);
    assertEquals(2.3, searchCluster.getVisibilityDelay(), 1E-6);
    ProtonConfig proton = getProtonConfig(cluster);
    assertEquals(searchCluster.getVisibilityDelay(), proton.documentdb(0).visibilitydelay(), 1E-6);
}
Also used : ProtonConfig(com.yahoo.vespa.config.search.core.ProtonConfig) IndexedSearchCluster(com.yahoo.vespa.model.search.IndexedSearchCluster) Test(org.junit.Test)

Example 5 with IndexedSearchCluster

use of com.yahoo.vespa.model.search.IndexedSearchCluster 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

IndexedSearchCluster (com.yahoo.vespa.model.search.IndexedSearchCluster)8 ProtonConfig (com.yahoo.vespa.config.search.core.ProtonConfig)3 VespaModel (com.yahoo.vespa.model.VespaModel)3 AbstractSearchCluster (com.yahoo.vespa.model.search.AbstractSearchCluster)3 VespaModelCreatorWithMockPkg (com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg)3 Test (org.junit.Test)3 ContentSearchCluster (com.yahoo.vespa.model.content.ContentSearchCluster)2 DocumentDatabase (com.yahoo.vespa.model.search.DocumentDatabase)2 ConfigModel (com.yahoo.config.model.ConfigModel)1 DeployState (com.yahoo.config.model.deploy.DeployState)1 DocumentSelector (com.yahoo.document.select.DocumentSelector)1 NewDocumentType (com.yahoo.documentmodel.NewDocumentType)1 IndexInfoConfig (com.yahoo.search.config.IndexInfoConfig)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 AttributesConfig (com.yahoo.vespa.config.search.AttributesConfig)1 IlscriptsConfig (com.yahoo.vespa.configdefinition.IlscriptsConfig)1 ContainerCluster (com.yahoo.vespa.model.container.ContainerCluster)1