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"));
}
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")));
}
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")));
}
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")));
}
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")));
}
Aggregations