Search in sources :

Example 6 with IndexedSearchCluster

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

the class RoutingSelectorValidator method validate.

@Override
public void validate(VespaModel model, DeployState deployState) {
    for (AbstractSearchCluster cluster : model.getSearchClusters()) {
        if (cluster instanceof IndexedSearchCluster) {
            IndexedSearchCluster sc = (IndexedSearchCluster) cluster;
            String routingSelector = sc.getRoutingSelector();
            if (routingSelector == null)
                continue;
            try {
                new DocumentSelector(routingSelector);
            } catch (com.yahoo.document.select.parser.ParseException e) {
                throw new IllegalArgumentException("Failed to parse routing selector for search cluster '" + sc.getClusterName() + "'", e);
            }
        }
    }
}
Also used : IndexedSearchCluster(com.yahoo.vespa.model.search.IndexedSearchCluster) DocumentSelector(com.yahoo.document.select.DocumentSelector) AbstractSearchCluster(com.yahoo.vespa.model.search.AbstractSearchCluster)

Example 7 with IndexedSearchCluster

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

the class DocumentDatabaseTestCase method requireThatWeCanHaveMultipleSearchDefinitions.

@Test
public void requireThatWeCanHaveMultipleSearchDefinitions() throws IOException, SAXException, ParseException {
    final List<String> sds = Arrays.asList("type1", "type2", "type3");
    VespaModel model = new VespaModelCreatorWithMockPkg(vespaHosts, createVespaServices(sds, "index"), ApplicationPackageUtils.generateSearchDefinitions(sds)).create();
    IndexedSearchCluster indexedSearchCluster = (IndexedSearchCluster) model.getSearchClusters().get(0);
    ContentSearchCluster contentSearchCluster = model.getContentClusters().get("test").getSearch();
    String type1Id = "test/search/cluster.test/type1";
    String type2Id = "test/search/cluster.test/type2";
    String type3Id = "test/search/cluster.test/type3";
    {
        assertEquals(3, indexedSearchCluster.getDocumentDbs().size());
        ProtonConfig proton = getProtonCfg(contentSearchCluster);
        assertEquals(3, proton.documentdb().size());
        assertEquals("type1", proton.documentdb(0).inputdoctypename());
        assertEquals(type1Id, proton.documentdb(0).configid());
        assertEquals("type2", proton.documentdb(1).inputdoctypename());
        assertEquals(type2Id, proton.documentdb(1).configid());
        assertEquals("type3", proton.documentdb(2).inputdoctypename());
        assertEquals(type3Id, proton.documentdb(2).configid());
    }
    assertDocTypeConfig(model, type1Id, "f1", "f2");
    assertDocTypeConfig(model, type2Id, "f3", "f4");
    assertDocTypeConfig(model, type3Id, "f5", "f6");
    {
        IndexInfoConfig iicfg = model.getConfig(IndexInfoConfig.class, "test/search/cluster.test");
        assertEquals(3, iicfg.indexinfo().size());
        assertEquals("type1", iicfg.indexinfo().get(0).name());
        assertEquals("type2", iicfg.indexinfo().get(1).name());
        assertEquals("type3", iicfg.indexinfo().get(2).name());
    }
    {
        AttributesConfig rac1 = model.getConfig(AttributesConfig.class, type1Id);
        assertEquals(2, rac1.attribute().size());
        assertEquals("f2", rac1.attribute(0).name());
        assertEquals("f2_nfa", rac1.attribute(1).name());
        AttributesConfig rac2 = model.getConfig(AttributesConfig.class, type2Id);
        assertEquals(2, rac2.attribute().size());
        assertEquals("f4", rac2.attribute(0).name());
        assertEquals("f4_nfa", rac2.attribute(1).name());
    }
    {
        IlscriptsConfig icfg = model.getConfig(IlscriptsConfig.class, "test/search/cluster.test");
        assertEquals(3, icfg.ilscript().size());
        assertEquals("type1", icfg.ilscript(0).doctype());
        assertEquals("type2", icfg.ilscript(1).doctype());
        assertEquals("type3", icfg.ilscript(2).doctype());
    }
}
Also used : ContentSearchCluster(com.yahoo.vespa.model.content.ContentSearchCluster) ProtonConfig(com.yahoo.vespa.config.search.core.ProtonConfig) IndexedSearchCluster(com.yahoo.vespa.model.search.IndexedSearchCluster) VespaModelCreatorWithMockPkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg) IlscriptsConfig(com.yahoo.vespa.configdefinition.IlscriptsConfig) VespaModel(com.yahoo.vespa.model.VespaModel) AttributesConfig(com.yahoo.vespa.config.search.AttributesConfig) IndexInfoConfig(com.yahoo.search.config.IndexInfoConfig) Test(org.junit.Test)

Example 8 with IndexedSearchCluster

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

the class DocumentDatabaseTestCase method assertSingleSD.

private void assertSingleSD(String mode) {
    final List<String> sds = Arrays.asList("type1");
    VespaModel model = new VespaModelCreatorWithMockPkg(vespaHosts, createVespaServices(sds, mode), ApplicationPackageUtils.generateSearchDefinitions(sds)).create();
    IndexedSearchCluster indexedSearchCluster = (IndexedSearchCluster) model.getSearchClusters().get(0);
    ContentSearchCluster contentSearchCluster = model.getContentClusters().get("test").getSearch();
    assertEquals(1, indexedSearchCluster.getDocumentDbs().size());
    String type1Id = "test/search/cluster.test/type1";
    ProtonConfig proton = getProtonCfg(contentSearchCluster);
    assertEquals(1, proton.documentdb().size());
    assertEquals("type1", proton.documentdb(0).inputdoctypename());
    assertEquals(type1Id, proton.documentdb(0).configid());
}
Also used : ContentSearchCluster(com.yahoo.vespa.model.content.ContentSearchCluster) ProtonConfig(com.yahoo.vespa.config.search.core.ProtonConfig) IndexedSearchCluster(com.yahoo.vespa.model.search.IndexedSearchCluster) VespaModelCreatorWithMockPkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg) VespaModel(com.yahoo.vespa.model.VespaModel)

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