Search in sources :

Example 1 with AttributesConfig

use of com.yahoo.vespa.config.search.AttributesConfig in project vespa by vespa-engine.

the class DocumentDatabaseTestCase method assertDocTypeConfig.

private void assertDocTypeConfig(VespaModel model, String configId, String indexField, String attributeField) {
    IndexschemaConfig icfg = model.getConfig(IndexschemaConfig.class, configId);
    assertEquals(1, icfg.indexfield().size());
    assertEquals(indexField, icfg.indexfield(0).name());
    AttributesConfig acfg = model.getConfig(AttributesConfig.class, configId);
    assertEquals(2, acfg.attribute().size());
    assertEquals(attributeField, acfg.attribute(0).name());
    assertEquals(attributeField + "_nfa", acfg.attribute(1).name());
    RankProfilesConfig rcfg = model.getConfig(RankProfilesConfig.class, configId);
    assertEquals(6, rcfg.rankprofile().size());
}
Also used : IndexschemaConfig(com.yahoo.vespa.config.search.IndexschemaConfig) RankProfilesConfig(com.yahoo.vespa.config.search.RankProfilesConfig) AttributesConfig(com.yahoo.vespa.config.search.AttributesConfig)

Example 2 with AttributesConfig

use of com.yahoo.vespa.config.search.AttributesConfig in project vespa by vespa-engine.

the class DocumentDatabaseTestCase method assertAttributesConfigIndependentOfMode.

private void assertAttributesConfigIndependentOfMode(String mode, List<String> sds, List<String> documentDBConfigIds, Map<String, List<String>> expectedAttributesMap) {
    VespaModel model = new VespaModelCreatorWithMockPkg(vespaHosts, createVespaServices(sds, mode), ApplicationPackageUtils.generateSearchDefinitions(sds)).create();
    ContentSearchCluster contentSearchCluster = model.getContentClusters().get("test").getSearch();
    ProtonConfig proton = getProtonCfg(contentSearchCluster);
    assertEquals(sds.size(), proton.documentdb().size());
    for (int i = 0; i < sds.size(); i++) {
        assertEquals(sds.get(i), proton.documentdb(i).inputdoctypename());
        assertEquals(documentDBConfigIds.get(i), proton.documentdb(i).configid());
        List<String> expectedAttributes = expectedAttributesMap.get(sds.get(i));
        if (expectedAttributes != null) {
            AttributesConfig rac1 = model.getConfig(AttributesConfig.class, proton.documentdb(i).configid());
            assertEquals(expectedAttributes.size(), rac1.attribute().size());
            for (int j = 0; j < expectedAttributes.size(); j++) {
                assertEquals(expectedAttributes.get(j), rac1.attribute(j).name());
            }
        }
    }
}
Also used : ContentSearchCluster(com.yahoo.vespa.model.content.ContentSearchCluster) ProtonConfig(com.yahoo.vespa.config.search.core.ProtonConfig) VespaModelCreatorWithMockPkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg) VespaModel(com.yahoo.vespa.model.VespaModel) AttributesConfig(com.yahoo.vespa.config.search.AttributesConfig)

Example 3 with AttributesConfig

use of com.yahoo.vespa.config.search.AttributesConfig in project vespa by vespa-engine.

the class DocumentDatabaseTestCase method requireThatRelevantConfigIsAvailableForClusterSearcher.

@Test
public void requireThatRelevantConfigIsAvailableForClusterSearcher() throws ParseException, IOException, SAXException {
    final List<String> sds = Arrays.asList("type1", "type2");
    VespaModel model = new VespaModelCreatorWithMockPkg(vespaHosts, createVespaServices(sds, "index"), ApplicationPackageUtils.generateSearchDefinitions(sds)).create();
    String searcherId = "container/searchchains/chain/test/component/com.yahoo.prelude.cluster.ClusterSearcher";
    {
        // documentdb-info config
        DocumentdbInfoConfig dcfg = model.getConfig(DocumentdbInfoConfig.class, searcherId);
        assertEquals(2, dcfg.documentdb().size());
        {
            // type1
            DocumentdbInfoConfig.Documentdb db = dcfg.documentdb(0);
            assertEquals("type1", db.name());
            assertEquals(6, db.rankprofile().size());
            assertRankProfile(db, 0, "default", false, false);
            assertRankProfile(db, 1, "unranked", false, false);
            assertRankProfile(db, 2, "staticrank", false, false);
            assertRankProfile(db, 3, "summaryfeatures", true, false);
            assertRankProfile(db, 4, "inheritedsummaryfeatures", true, false);
            assertRankProfile(db, 5, "rankfeatures", false, true);
            assertEquals(2, db.summaryclass().size());
            assertEquals("default", db.summaryclass(0).name());
            assertEquals("attributeprefetch", db.summaryclass(1).name());
            assertSummaryField(db, 0, 0, "f1", "longstring", true);
            assertSummaryField(db, 0, 1, "f2", "integer", false);
        }
        {
            // type2
            DocumentdbInfoConfig.Documentdb db = dcfg.documentdb(1);
            assertEquals("type2", db.name());
        }
    }
    {
        // attributes config
        AttributesConfig acfg = model.getConfig(AttributesConfig.class, searcherId);
        assertEquals(4, acfg.attribute().size());
        assertEquals("f2", acfg.attribute(0).name());
        assertEquals("f2_nfa", acfg.attribute(1).name());
        assertEquals("f4", acfg.attribute(2).name());
        assertEquals("f4_nfa", acfg.attribute(3).name());
    }
}
Also used : VespaModelCreatorWithMockPkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg) DocumentdbInfoConfig(com.yahoo.prelude.fastsearch.DocumentdbInfoConfig) VespaModel(com.yahoo.vespa.model.VespaModel) AttributesConfig(com.yahoo.vespa.config.search.AttributesConfig) Test(org.junit.Test)

Example 4 with AttributesConfig

use of com.yahoo.vespa.config.search.AttributesConfig in project vespa by vespa-engine.

the class RankSetupValidator method writeConfigs.

private void writeConfigs(String dir, AbstractConfigProducer producer) throws IOException {
    RankProfilesConfig.Builder rpcb = new RankProfilesConfig.Builder();
    RankProfilesConfig.Producer.class.cast(producer).getConfig(rpcb);
    RankProfilesConfig rpc = new RankProfilesConfig(rpcb);
    writeConfig(dir, RankProfilesConfig.getDefName() + ".cfg", rpc);
    IndexschemaConfig.Builder iscb = new IndexschemaConfig.Builder();
    IndexschemaConfig.Producer.class.cast(producer).getConfig(iscb);
    IndexschemaConfig isc = new IndexschemaConfig(iscb);
    writeConfig(dir, IndexschemaConfig.getDefName() + ".cfg", isc);
    AttributesConfig.Builder acb = new AttributesConfig.Builder();
    AttributesConfig.Producer.class.cast(producer).getConfig(acb);
    AttributesConfig ac = new AttributesConfig(acb);
    writeConfig(dir, AttributesConfig.getDefName() + ".cfg", ac);
    RankingConstantsConfig.Builder rccb = new RankingConstantsConfig.Builder();
    RankingConstantsConfig.Producer.class.cast(producer).getConfig(rccb);
    RankingConstantsConfig rcc = new RankingConstantsConfig(rccb);
    writeConfig(dir, RankingConstantsConfig.getDefName() + ".cfg", rcc);
    ImportedFieldsConfig.Builder ifcb = new ImportedFieldsConfig.Builder();
    ImportedFieldsConfig.Producer.class.cast(producer).getConfig(ifcb);
    ImportedFieldsConfig ifc = new ImportedFieldsConfig(ifcb);
    writeConfig(dir, ImportedFieldsConfig.getDefName() + ".cfg", ifc);
}
Also used : AbstractConfigProducer(com.yahoo.config.model.producer.AbstractConfigProducer) ImportedFieldsConfig(com.yahoo.vespa.config.search.ImportedFieldsConfig) RankProfilesConfig(com.yahoo.vespa.config.search.RankProfilesConfig) IndexschemaConfig(com.yahoo.vespa.config.search.IndexschemaConfig) AttributesConfig(com.yahoo.vespa.config.search.AttributesConfig) RankingConstantsConfig(com.yahoo.vespa.config.search.core.RankingConstantsConfig)

Example 5 with AttributesConfig

use of com.yahoo.vespa.config.search.AttributesConfig 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)

Aggregations

AttributesConfig (com.yahoo.vespa.config.search.AttributesConfig)6 VespaModel (com.yahoo.vespa.model.VespaModel)3 VespaModelCreatorWithMockPkg (com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg)3 IndexschemaConfig (com.yahoo.vespa.config.search.IndexschemaConfig)2 RankProfilesConfig (com.yahoo.vespa.config.search.RankProfilesConfig)2 ProtonConfig (com.yahoo.vespa.config.search.core.ProtonConfig)2 ContentSearchCluster (com.yahoo.vespa.model.content.ContentSearchCluster)2 Test (org.junit.Test)2 AbstractConfigProducer (com.yahoo.config.model.producer.AbstractConfigProducer)1 QrSearchersConfig (com.yahoo.container.QrSearchersConfig)1 DocumentdbInfoConfig (com.yahoo.prelude.fastsearch.DocumentdbInfoConfig)1 ClusterConfig (com.yahoo.search.config.ClusterConfig)1 IndexInfoConfig (com.yahoo.search.config.IndexInfoConfig)1 Execution (com.yahoo.search.searchchain.Execution)1 ImportedFieldsConfig (com.yahoo.vespa.config.search.ImportedFieldsConfig)1 RankingConstantsConfig (com.yahoo.vespa.config.search.core.RankingConstantsConfig)1 IlscriptsConfig (com.yahoo.vespa.configdefinition.IlscriptsConfig)1 IndexedSearchCluster (com.yahoo.vespa.model.search.IndexedSearchCluster)1