Search in sources :

Example 11 with CompiledQueryProfile

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

the class QueryProfileVariantsTestCase method testVariantNotInBaseSpaceVariantValue.

public void testVariantNotInBaseSpaceVariantValue() {
    QueryProfile test = new QueryProfile("test");
    test.setDimensions(new String[] { "x" });
    test.set("InX1Only", "x1", new String[] { "x 1" }, null);
    CompiledQueryProfile ctest = test.compile(null);
    assertEquals("x1", ctest.get("InX1Only", toMap("x=x 1")));
    assertEquals(null, ctest.get("InX1Only", toMap("x=x 2")));
    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)

Example 12 with CompiledQueryProfile

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

the class QueryProfileVariantsTestCase method testVariantInheritanceWithTwoLevelCompoundReferencesVariantAtSecondLevel.

public void testVariantInheritanceWithTwoLevelCompoundReferencesVariantAtSecondLevel() {
    QueryProfile test = new QueryProfile("test");
    test.setDimensions(new String[] { "x" });
    QueryProfile ac = new QueryProfile("ac");
    ac.set("a.c", "referenced-a.c", (QueryProfileRegistry) null);
    test.addInherited(ac, new String[] { "x1" });
    test.set("a.b", "x1-a.b", new String[] { "x1" }, null);
    QueryProfile top = new QueryProfile("top");
    top.set("o.a.b", "default-a.b", (QueryProfileRegistry) null);
    top.set("o", test, (QueryProfileRegistry) null);
    CompiledQueryProfile ctop = top.compile(null);
    assertEquals("Basic functionality", "default-a.b", ctop.get("o.a.b"));
    assertEquals("Inherited variance reference works", "referenced-a.c", ctop.get("o.a.c", toMap("x=x1")));
    // Note: Changed from x1-a.b in 4.2.3
    assertEquals("Inherited variance reference does not override value set in referent", "default-a.b", ctop.get("o.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 13 with CompiledQueryProfile

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

the class QueryProfileVariantsTestCase method testDimensionsInSuperType.

public void testDimensionsInSuperType() {
    QueryProfile parent = new QueryProfile("parent");
    parent.setDimensions(new String[] { "x", "y" });
    QueryProfile child = new QueryProfile("child");
    child.addInherited(parent);
    child.set("a", "a.default", (QueryProfileRegistry) null);
    child.set("a", "a.x1.y1", new String[] { "x1", "y1" }, null);
    child.set("a", "a.x1.y2", new String[] { "x1", "y2" }, null);
    CompiledQueryProfile cchild = child.compile(null);
    assertEquals("a.default", cchild.get("a"));
    assertEquals("a.x1.y1", cchild.get("a", toMap("x=x1", "y=y1")));
    assertEquals("a.x1.y2", cchild.get("a", toMap("x=x1", "y=y2")));
}
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 14 with CompiledQueryProfile

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

the class QueryProfileVariantsTestCase method testVariantInheritanceSimplified.

public void testVariantInheritanceSimplified() {
    QueryProfile test = new QueryProfile("test");
    test.setDimensions(new String[] { "x", "y" });
    QueryProfile x1y2Parent = new QueryProfile("x1y2Parent");
    x1y2Parent.set("c", "c-x1y2", (QueryProfileRegistry) null);
    test.addInherited(x1y2Parent, new String[] { "x1", "y2" });
    test.set("c", "c-x1", new String[] { "x1" }, null);
    CompiledQueryProfile ctest = test.compile(null);
    assertEquals(null, ctest.get("c"));
    assertEquals("c-x1", ctest.get("c", toMap("x=x1")));
    assertEquals("c-x1", ctest.get("c", toMap("x=x1", "y=y1")));
    assertEquals("c-x1y2", ctest.get("c", toMap("x=x1", "y=y2")));
}
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 15 with CompiledQueryProfile

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

the class QueryProfileVariantsTestCase method testVariantsOfExplicitCompound.

public void testVariantsOfExplicitCompound() {
    QueryProfile a1 = new QueryProfile("a1");
    a1.set("b", "a.b", (QueryProfileRegistry) null);
    QueryProfile profile = new QueryProfile("test");
    profile.setDimensions(new String[] { "x" });
    profile.set("a", a1, (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)

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