Search in sources :

Example 11 with QueryProfiles

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

the class QueryProfileVariantsTestCase method testVariantsOfExplicitCompound.

@Test
public void testVariantsOfExplicitCompound() throws IOException {
    QueryProfileRegistry registry = new QueryProfileRegistry();
    QueryProfile a1 = new QueryProfile("a1");
    a1.set("b", "a1.b", registry);
    QueryProfile profile = new QueryProfile("test");
    profile.setDimensions(new String[] { "x" });
    profile.set("a", a1, registry);
    profile.set("a.b", "a.b.x1", new String[] { "x1" }, registry);
    profile.set("a.b", "a.b.x2", new String[] { "x2" }, registry);
    registry.register(a1);
    registry.register(profile);
    QueryProfiles profiles = new QueryProfiles(registry);
    assertSerializedConfigFileEquals(root + "variants-of-explicit-compound.cfg", profiles.getConfig().toString());
}
Also used : QueryProfile(com.yahoo.search.query.profile.QueryProfile) QueryProfiles(com.yahoo.vespa.model.container.search.QueryProfiles) QueryProfileRegistry(com.yahoo.search.query.profile.QueryProfileRegistry) Test(org.junit.Test)

Example 12 with QueryProfiles

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

the class IntegerIndex2AttributeTestCase method testIntegerIndex2Attribute.

@Test
public void testIntegerIndex2Attribute() throws IOException, ParseException {
    Search search = UnprocessingSearchBuilder.buildUnprocessedFromFile("src/test/examples/integerindex2attribute.sd");
    search.process();
    new IntegerIndex2Attribute(search, new BaseDeployLogger(), new RankProfileRegistry(), new QueryProfiles()).process(true);
    SDField f;
    f = search.getConcreteField("s1");
    assertTrue(f.getAttributes().isEmpty());
    assertTrue(f.existsIndex("s1"));
    f = search.getConcreteField("s2");
    assertEquals(f.getAttributes().size(), 1);
    assertTrue(f.existsIndex("s2"));
    f = search.getConcreteField("as1");
    assertTrue(f.getAttributes().isEmpty());
    assertTrue(f.existsIndex("as1"));
    f = search.getConcreteField("as2");
    assertEquals(f.getAttributes().size(), 1);
    assertTrue(f.existsIndex("as2"));
    f = search.getConcreteField("i1");
    assertEquals(f.getAttributes().size(), 1);
    assertTrue(!f.existsIndex("i1"));
    f = search.getConcreteField("i2");
    assertEquals(f.getAttributes().size(), 1);
    assertTrue(!f.existsIndex("i2"));
    f = search.getConcreteField("ai1");
    assertEquals(search.getConcreteField("ai1").getAttributes().size(), 1);
    assertTrue(!search.getConcreteField("ai1").existsIndex("ai1"));
    f = search.getConcreteField("ai2");
    assertEquals(f.getAttributes().size(), 1);
    assertTrue(!f.existsIndex("ai2"));
}
Also used : RankProfileRegistry(com.yahoo.searchdefinition.RankProfileRegistry) SDField(com.yahoo.searchdefinition.document.SDField) BaseDeployLogger(com.yahoo.config.model.application.provider.BaseDeployLogger) Search(com.yahoo.searchdefinition.Search) QueryProfiles(com.yahoo.vespa.model.container.search.QueryProfiles) Test(org.junit.Test)

Example 13 with QueryProfiles

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

the class QueryProfilesTestCase method assertConfig.

protected void assertConfig(String correctFileName, QueryProfileRegistry check) throws IOException {
    assertSerializedConfigFileEquals(root + "/" + correctFileName, com.yahoo.text.StringUtilities.implodeMultiline(com.yahoo.config.ConfigInstance.serialize(new QueryProfiles(check).getConfig())));
    // Also assert that the correct config config can actually be read as a config source
    QueryProfileConfigurer configurer = new QueryProfileConfigurer("file:" + root + "empty.cfg");
    configurer.shutdown();
}
Also used : QueryProfileConfigurer(com.yahoo.search.query.profile.config.QueryProfileConfigurer) QueryProfiles(com.yahoo.vespa.model.container.search.QueryProfiles)

Example 14 with QueryProfiles

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

the class IndexingScriptRewriterTestCase method processField.

private static ScriptExpression processField(SDField unprocessedField) {
    SDDocumentType sdoc = new SDDocumentType("test");
    sdoc.addField(unprocessedField);
    Search search = new Search("test", null);
    search.addDocument(sdoc);
    Processing.process(search, new BaseDeployLogger(), new RankProfileRegistry(), new QueryProfiles(), true);
    return unprocessedField.getIndexingScript();
}
Also used : RankProfileRegistry(com.yahoo.searchdefinition.RankProfileRegistry) SDDocumentType(com.yahoo.searchdefinition.document.SDDocumentType) BaseDeployLogger(com.yahoo.config.model.application.provider.BaseDeployLogger) Search(com.yahoo.searchdefinition.Search) QueryProfiles(com.yahoo.vespa.model.container.search.QueryProfiles)

Example 15 with QueryProfiles

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

the class SummaryFieldsMustHaveValidSourceTestCase method requireThatDocumentIdIsAllowedToPass.

@Test
public void requireThatDocumentIdIsAllowedToPass() throws IOException, ParseException {
    Search search = UnprocessingSearchBuilder.buildUnprocessedFromFile("src/test/examples/documentidinsummary.sd");
    search.process();
    BaseDeployLogger deployLogger = new BaseDeployLogger();
    RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
    new SummaryFieldsMustHaveValidSource(search, deployLogger, rankProfileRegistry, new QueryProfiles()).process(true);
    assertEquals("documentid", search.getSummary("withid").getSummaryField("w").getSingleSource());
}
Also used : BaseDeployLogger(com.yahoo.config.model.application.provider.BaseDeployLogger) QueryProfiles(com.yahoo.vespa.model.container.search.QueryProfiles) Test(org.junit.Test)

Aggregations

QueryProfiles (com.yahoo.vespa.model.container.search.QueryProfiles)20 Test (org.junit.Test)17 BaseDeployLogger (com.yahoo.config.model.application.provider.BaseDeployLogger)11 QueryProfileRegistry (com.yahoo.search.query.profile.QueryProfileRegistry)10 RankProfileRegistry (com.yahoo.searchdefinition.RankProfileRegistry)8 Search (com.yahoo.searchdefinition.Search)8 SDDocumentType (com.yahoo.searchdefinition.document.SDDocumentType)6 SDField (com.yahoo.searchdefinition.document.SDField)5 QueryProfileXMLReader (com.yahoo.search.query.profile.config.QueryProfileXMLReader)4 QueryProfile (com.yahoo.search.query.profile.QueryProfile)3 QueryProfileConfigurer (com.yahoo.search.query.profile.config.QueryProfileConfigurer)1 RankProfile (com.yahoo.searchdefinition.RankProfile)1 SearchOrderer (com.yahoo.searchdefinition.derived.SearchOrderer)1 MakeAliases (com.yahoo.searchdefinition.processing.MakeAliases)1 SummarymapConfig (com.yahoo.vespa.config.search.SummarymapConfig)1 ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1