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