use of com.yahoo.search.query.profile.QueryProfile in project vespa by vespa-engine.
the class QueryProfileTestCase method testInheritance2Level.
public void testInheritance2Level() {
QueryProfile barn = new QueryProfile("barn");
QueryProfile mor = new QueryProfile("mor");
QueryProfile far = new QueryProfile("far");
QueryProfile mormor = new QueryProfile("mormor");
QueryProfile morfar = new QueryProfile("morfar");
QueryProfile farfar = new QueryProfile("farfar");
barn.addInherited(mor);
barn.addInherited(far);
mor.addInherited(mormor);
mor.addInherited(morfar);
far.addInherited(farfar);
morfar.set("a.x", "morfar-a", (QueryProfileRegistry) null);
mormor.set("a.x", "mormor-a", (QueryProfileRegistry) null);
farfar.set("a.x", "farfar-a", (QueryProfileRegistry) null);
mor.set("a.x", "mor-a", (QueryProfileRegistry) null);
far.set("a.x", "far-a", (QueryProfileRegistry) null);
barn.set("a.x", "barn-a", (QueryProfileRegistry) null);
mormor.set("b.x", "mormor-b", (QueryProfileRegistry) null);
far.set("b.x", "far-b", (QueryProfileRegistry) null);
mor.set("c.x", "mor-c", (QueryProfileRegistry) null);
far.set("c.x", "far-c", (QueryProfileRegistry) null);
mor.set("d.a.x", "mor-d.a", (QueryProfileRegistry) null);
barn.set("d.b.x", "barn-d.b", (QueryProfileRegistry) null);
QueryProfile annetBarn = new QueryProfile("annetBarn");
annetBarn.set("venn", barn, (QueryProfileRegistry) null);
CompiledQueryProfile cbarn = barn.compile(null);
CompiledQueryProfile cannetBarn = annetBarn.compile(null);
assertEquals("barn-a", cbarn.get("a.x"));
assertEquals("mormor-b", cbarn.get("b.x"));
assertEquals("mor-c", cbarn.get("c.x"));
assertEquals("barn-a", cannetBarn.get("venn.a.x"));
assertEquals("mormor-b", cannetBarn.get("venn.b.x"));
assertEquals("mor-c", cannetBarn.get("venn.c.x"));
assertEquals("barn-d.b", cbarn.get("d.b.x"));
assertEquals("mor-d.a", cbarn.get("d.a.x"));
}
use of com.yahoo.search.query.profile.QueryProfile in project vespa by vespa-engine.
the class QueryProfileTestCase method testInheritance3Level.
public void testInheritance3Level() {
QueryProfile barn = new QueryProfile("barn");
QueryProfile mor = new QueryProfile("mor");
QueryProfile far = new QueryProfile("far");
QueryProfile mormor = new QueryProfile("mormor");
QueryProfile morfar = new QueryProfile("morfar");
QueryProfile farfar = new QueryProfile("farfar");
barn.addInherited(mor);
barn.addInherited(far);
mor.addInherited(mormor);
mor.addInherited(morfar);
far.addInherited(farfar);
morfar.set("y.a.x", "morfar-a", (QueryProfileRegistry) null);
mormor.set("y.a.x", "mormor-a", (QueryProfileRegistry) null);
farfar.set("y.a.x", "farfar-a", (QueryProfileRegistry) null);
mor.set("y.a.x", "mor-a", (QueryProfileRegistry) null);
far.set("y.a.x", "far-a", (QueryProfileRegistry) null);
barn.set("y.a.x", "barn-a", (QueryProfileRegistry) null);
mormor.set("y.b.x", "mormor-b", (QueryProfileRegistry) null);
far.set("y.b.x", "far-b", (QueryProfileRegistry) null);
mor.set("y.c.x", "mor-c", (QueryProfileRegistry) null);
far.set("y.c.x", "far-c", (QueryProfileRegistry) null);
mor.set("y.d.a.x", "mor-d.a", (QueryProfileRegistry) null);
barn.set("y.d.b.x", "barn-d.b", (QueryProfileRegistry) null);
QueryProfile annetBarn = new QueryProfile("annetBarn");
annetBarn.set("venn", barn, (QueryProfileRegistry) null);
CompiledQueryProfile cbarn = barn.compile(null);
CompiledQueryProfile cannetBarn = annetBarn.compile(null);
assertEquals("barn-a", cbarn.get("y.a.x"));
assertEquals("mormor-b", cbarn.get("y.b.x"));
assertEquals("mor-c", cbarn.get("y.c.x"));
assertEquals("barn-a", cannetBarn.get("venn.y.a.x"));
assertEquals("mormor-b", cannetBarn.get("venn.y.b.x"));
assertEquals("mor-c", cannetBarn.get("venn.y.c.x"));
assertEquals("barn-d.b", cbarn.get("y.d.b.x"));
assertEquals("mor-d.a", cbarn.get("y.d.a.x"));
}
use of com.yahoo.search.query.profile.QueryProfile in project vespa by vespa-engine.
the class QueryProfileTestCase method testSettingNonLeaf3b.
public void testSettingNonLeaf3b() {
QueryProfile p = new QueryProfile("test");
p.setDimensions(new String[] { "x" });
p.set("a", "a-value", new String[] { "x1" }, null);
p.set("a.b", "a.b-value", (QueryProfileRegistry) null);
QueryProfileProperties cp = new QueryProfileProperties(p.compile(null));
assertNull(cp.get("a"));
assertEquals("a.b-value", cp.get("a.b"));
assertEquals("a-value", cp.get("a", QueryProfileVariantsTestCase.toMap(p, new String[] { "x1" })));
assertEquals("a.b-value", cp.get("a.b", new String[] { "x1" }));
}
use of com.yahoo.search.query.profile.QueryProfile in project vespa by vespa-engine.
the class QueryProfileTestCase method testRankTypeNames.
public void testRankTypeNames() {
QueryProfile p = new QueryProfile("test");
p.set("a.$b", "foo", (QueryProfileRegistry) null);
p.set("a.query(b)", "bar", (QueryProfileRegistry) null);
p.set("a.b.default-index", "fuu", (QueryProfileRegistry) null);
CompiledQueryProfile cp = p.compile(null);
assertEquals("foo", cp.get("a.$b"));
assertEquals("bar", cp.get("a.query(b)"));
assertEquals("fuu", cp.get("a.b.default-index"));
Map<String, Object> p1 = cp.listValues("");
assertEquals("foo", p1.get("a.$b"));
assertEquals("bar", p1.get("a.query(b)"));
assertEquals("fuu", p1.get("a.b.default-index"));
Map<String, Object> p2 = cp.listValues("a");
assertEquals("foo", p2.get("$b"));
assertEquals("bar", p2.get("query(b)"));
assertEquals("fuu", p2.get("b.default-index"));
}
use of com.yahoo.search.query.profile.QueryProfile in project vespa by vespa-engine.
the class QueryProfileTestCase method testQueryProfileInlineValueReassignment.
public void testQueryProfileInlineValueReassignment() {
QueryProfile p = new QueryProfile("test");
p.set("source.rel.params.query", "%{model.queryString}", (QueryProfileRegistry) null);
p.freeze();
Query q = new Query(HttpRequest.createTestRequest("?query=foo", Method.GET), p.compile(null));
assertEquals("foo", q.properties().get("source.rel.params.query"));
assertEquals("foo", q.properties().listProperties().get("source.rel.params.query"));
q.getModel().setQueryString("bar");
assertEquals("bar", q.properties().get("source.rel.params.query"));
// Is still foo because model variables are not supported with the list function
assertEquals("foo", q.properties().listProperties().get("source.rel.params.query"));
}
Aggregations