Search in sources :

Example 36 with CompiledQueryProfile

use of com.yahoo.search.query.profile.compiled.CompiledQueryProfile in project vespa by vespa-engine.

the class QueryProfileVariantsTestCase method testNewsCase2.

public void testNewsCase2() {
    QueryProfile test = new QueryProfile("test");
    test.setDimensions("sort,resulttypes,rss,age,intl,testid".split(","));
    String[] dimensionValues = new String[] { null, null, "0" };
    test.set("discovery", "sources", dimensionValues, null);
    test.set("discoverytypes", "article", dimensionValues, null);
    test.set("discovery.sources.count", "10", dimensionValues, null);
    CompiledQueryProfile ctest = test.compile(null);
    assertEquals("sources", ctest.get("discovery", toMap(test, dimensionValues)));
    assertEquals("article", ctest.get("discoverytypes", toMap(test, dimensionValues)));
    assertEquals("10", ctest.get("discovery.sources.count", toMap(test, dimensionValues)));
    Map<String, Object> values = ctest.listValues("", toMap(test, dimensionValues));
    assertEquals(3, values.size());
    assertEquals("sources", values.get("discovery"));
    assertEquals("article", values.get("discoverytypes"));
    assertEquals("10", values.get("discovery.sources.count"));
    Map<String, Object> sourceValues = ctest.listValues("discovery.sources", toMap(test, dimensionValues));
    assertEquals(1, sourceValues.size());
    assertEquals("10", sourceValues.get("count"));
}
Also used : CompiledQueryProfile(com.yahoo.search.query.profile.compiled.CompiledQueryProfile) QueryProfile(com.yahoo.search.query.profile.QueryProfile) BackedOverridableQueryProfile(com.yahoo.search.query.profile.BackedOverridableQueryProfile) CompiledQueryProfile(com.yahoo.search.query.profile.compiled.CompiledQueryProfile)

Example 37 with CompiledQueryProfile

use of com.yahoo.search.query.profile.compiled.CompiledQueryProfile in project vespa by vespa-engine.

the class QueryProfileVariantsTestCase method testVariantsOfInlineCompound.

public void testVariantsOfInlineCompound() {
    QueryProfile profile = new QueryProfile("test");
    profile.setDimensions(new String[] { "x" });
    profile.set("a.b", "a.b", (QueryProfileRegistry) null);
    profile.set("a.b", "a.b.x1", new String[] { "x1" }, null);
    profile.set("a.b", "a.b.x2", new String[] { "x2" }, null);
    CompiledQueryProfile cprofile = profile.compile(null);
    assertEquals("a.b", cprofile.get("a.b"));
    assertEquals("a.b.x1", cprofile.get("a.b", toMap("x=x1")));
    assertEquals("a.b.x2", cprofile.get("a.b", toMap("x=x2")));
}
Also used : CompiledQueryProfile(com.yahoo.search.query.profile.compiled.CompiledQueryProfile) QueryProfile(com.yahoo.search.query.profile.QueryProfile) BackedOverridableQueryProfile(com.yahoo.search.query.profile.BackedOverridableQueryProfile) CompiledQueryProfile(com.yahoo.search.query.profile.compiled.CompiledQueryProfile)

Example 38 with CompiledQueryProfile

use of com.yahoo.search.query.profile.compiled.CompiledQueryProfile in project vespa by vespa-engine.

the class QueryProfileVariantsTestCase method testVariantInheritanceOverridesBaseInheritance2.

public void testVariantInheritanceOverridesBaseInheritance2() {
    QueryProfile test = new QueryProfile("test");
    QueryProfile baseInherited = new QueryProfile("baseInherited");
    baseInherited.set("a.b", "baseInherited-a.b", (QueryProfileRegistry) null);
    QueryProfile variantInherited = new QueryProfile("variantInherited");
    variantInherited.set("a.b", "variantInherited-a.b", (QueryProfileRegistry) null);
    test.setDimensions(new String[] { "x" });
    test.addInherited(baseInherited);
    test.addInherited(variantInherited, new String[] { "x1" });
    test.set("a.c", "variant-a.c", new String[] { "x1" }, null);
    CompiledQueryProfile ctest = test.compile(null);
    assertEquals("baseInherited-a.b", ctest.get("a.b"));
    assertEquals("variantInherited-a.b", ctest.get("a.b", toMap("x=x1")));
    assertEquals("variant-a.c", ctest.get("a.c", toMap("x=x1")));
}
Also used : CompiledQueryProfile(com.yahoo.search.query.profile.compiled.CompiledQueryProfile) QueryProfile(com.yahoo.search.query.profile.QueryProfile) BackedOverridableQueryProfile(com.yahoo.search.query.profile.BackedOverridableQueryProfile) CompiledQueryProfile(com.yahoo.search.query.profile.compiled.CompiledQueryProfile)

Example 39 with CompiledQueryProfile

use of com.yahoo.search.query.profile.compiled.CompiledQueryProfile in project vespa by vespa-engine.

the class QueryProfileVariantsTestCase method testVariantInheritanceOverridesBaseInheritance1.

public void testVariantInheritanceOverridesBaseInheritance1() {
    QueryProfile test = new QueryProfile("test");
    QueryProfile baseInherited = new QueryProfile("baseInherited");
    baseInherited.set("a.b", "baseInherited-a.b", (QueryProfileRegistry) null);
    QueryProfile variantInherited = new QueryProfile("variantInherited");
    variantInherited.set("a.b", "variantInherited-a.b", (QueryProfileRegistry) null);
    test.setDimensions(new String[] { "x" });
    test.addInherited(baseInherited);
    test.addInherited(variantInherited, new String[] { "x1" });
    CompiledQueryProfile ctest = test.compile(null);
    assertEquals("baseInherited-a.b", ctest.get("a.b"));
    assertEquals("variantInherited-a.b", ctest.get("a.b", toMap("x=x1")));
}
Also used : CompiledQueryProfile(com.yahoo.search.query.profile.compiled.CompiledQueryProfile) QueryProfile(com.yahoo.search.query.profile.QueryProfile) BackedOverridableQueryProfile(com.yahoo.search.query.profile.BackedOverridableQueryProfile) CompiledQueryProfile(com.yahoo.search.query.profile.compiled.CompiledQueryProfile)

Example 40 with CompiledQueryProfile

use of com.yahoo.search.query.profile.compiled.CompiledQueryProfile in project vespa by vespa-engine.

the class QueryProfileVariantsTestCase method testVariantNotInBase.

public void testVariantNotInBase() {
    QueryProfile test = new QueryProfile("test");
    test.setDimensions(new String[] { "x" });
    test.set("InX1Only", "x1", new String[] { "x1" }, null);
    CompiledQueryProfile ctest = test.compile(null);
    assertEquals("x1", ctest.get("InX1Only", toMap("x=x1")));
    assertEquals(null, ctest.get("InX1Only", toMap("x=x2")));
    assertEquals(null, ctest.get("InX1Only"));
}
Also used : CompiledQueryProfile(com.yahoo.search.query.profile.compiled.CompiledQueryProfile) QueryProfile(com.yahoo.search.query.profile.QueryProfile) BackedOverridableQueryProfile(com.yahoo.search.query.profile.BackedOverridableQueryProfile) CompiledQueryProfile(com.yahoo.search.query.profile.compiled.CompiledQueryProfile)

Aggregations

CompiledQueryProfile (com.yahoo.search.query.profile.compiled.CompiledQueryProfile)48 QueryProfile (com.yahoo.search.query.profile.QueryProfile)37 BackedOverridableQueryProfile (com.yahoo.search.query.profile.BackedOverridableQueryProfile)18 Query (com.yahoo.search.Query)8 CompiledQueryProfileRegistry (com.yahoo.search.query.profile.compiled.CompiledQueryProfileRegistry)8 Test (org.junit.Test)7 CompoundName (com.yahoo.processing.request.CompoundName)5 QueryProfileXMLReader (com.yahoo.search.query.profile.config.QueryProfileXMLReader)4 HashMap (java.util.HashMap)4 HttpRequest (com.yahoo.container.jdisc.HttpRequest)3 QueryProfileProperties (com.yahoo.search.query.profile.QueryProfileProperties)3 QueryProfileRegistry (com.yahoo.search.query.profile.QueryProfileRegistry)3 QueryProfileType (com.yahoo.search.query.profile.types.QueryProfileType)3 Map (java.util.Map)3 QueryProfileConfigurer (com.yahoo.search.query.profile.config.QueryProfileConfigurer)2 FieldDescription (com.yahoo.search.query.profile.types.FieldDescription)2 HashSet (java.util.HashSet)2 ImmutableMap (com.google.common.collect.ImmutableMap)1 Chain (com.yahoo.component.chain.Chain)1 Renderer (com.yahoo.processing.rendering.Renderer)1