Search in sources :

Example 1 with QueryProfileProperties

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

the class QueryProfileTestCase method testSettingNonLeaf4a.

public void testSettingNonLeaf4a() {
    QueryProfile p = new QueryProfile("test");
    p.setDimensions(new String[] { "x" });
    p.set("a.b", "a.b-value", new String[] { "x1" }, null);
    p.set("a", "a-value", (QueryProfileRegistry) null);
    QueryProfileProperties cp = new QueryProfileProperties(p.compile(null));
    assertEquals("a-value", cp.get("a"));
    assertNull(cp.get("a.b"));
    assertEquals("a-value", cp.get("a", new String[] { "x1" }));
    assertEquals("a.b-value", cp.get("a.b", QueryProfileVariantsTestCase.toMap(p, new String[] { "x1" })));
}
Also used : CompiledQueryProfile(com.yahoo.search.query.profile.compiled.CompiledQueryProfile) QueryProfile(com.yahoo.search.query.profile.QueryProfile) QueryProfileProperties(com.yahoo.search.query.profile.QueryProfileProperties)

Example 2 with QueryProfileProperties

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

the class QueryProfileTestCase method testListProperties.

public void testListProperties() {
    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", "morfar-a", (QueryProfileRegistry) null);
    morfar.set("model.b", "morfar-model.b", (QueryProfileRegistry) null);
    mormor.set("a", "mormor-a", (QueryProfileRegistry) null);
    mormor.set("model.b", "mormor-model.b", (QueryProfileRegistry) null);
    farfar.set("a", "farfar-a", (QueryProfileRegistry) null);
    mor.set("a", "mor-a", (QueryProfileRegistry) null);
    far.set("a", "far-a", (QueryProfileRegistry) null);
    barn.set("a", "barn-a", (QueryProfileRegistry) null);
    mormor.set("b", "mormor-b", (QueryProfileRegistry) null);
    far.set("b", "far-b", (QueryProfileRegistry) null);
    mor.set("c", "mor-c", (QueryProfileRegistry) null);
    far.set("c", "far-c", (QueryProfileRegistry) null);
    CompiledQueryProfile cbarn = barn.compile(null);
    QueryProfileProperties properties = new QueryProfileProperties(cbarn);
    assertEquals("barn-a", cbarn.get("a"));
    assertEquals("mormor-b", cbarn.get("b"));
    Map<String, Object> rootMap = properties.listProperties();
    assertEquals("barn-a", rootMap.get("a"));
    assertEquals("mormor-b", rootMap.get("b"));
    assertEquals("mor-c", rootMap.get("c"));
    Map<String, Object> modelMap = properties.listProperties("model");
    assertEquals("mormor-model.b", modelMap.get("b"));
    QueryProfile annetBarn = new QueryProfile("annetBarn");
    annetBarn.set("venn", barn, (QueryProfileRegistry) null);
    CompiledQueryProfile cannetBarn = annetBarn.compile(null);
    Map<String, Object> annetBarnMap = new QueryProfileProperties(cannetBarn).listProperties();
    assertEquals("barn-a", annetBarnMap.get("venn.a"));
    assertEquals("mormor-b", annetBarnMap.get("venn.b"));
    assertEquals("mor-c", annetBarnMap.get("venn.c"));
    assertEquals("mormor-model.b", annetBarnMap.get("venn.model.b"));
}
Also used : CompiledQueryProfile(com.yahoo.search.query.profile.compiled.CompiledQueryProfile) QueryProfile(com.yahoo.search.query.profile.QueryProfile) CompiledQueryProfile(com.yahoo.search.query.profile.compiled.CompiledQueryProfile) QueryProfileProperties(com.yahoo.search.query.profile.QueryProfileProperties)

Example 3 with QueryProfileProperties

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

the class QueryProfileTestCase method testSettingNonLeaf2.

public void testSettingNonLeaf2() {
    QueryProfile p = new QueryProfile("test");
    p.set("a.b", "a.b-value", (QueryProfileRegistry) null);
    p.set("a", "a-value", (QueryProfileRegistry) null);
    QueryProfileProperties cp = new QueryProfileProperties(p.compile(null));
    assertEquals("a-value", cp.get("a"));
    assertEquals("a.b-value", cp.get("a.b"));
}
Also used : CompiledQueryProfile(com.yahoo.search.query.profile.compiled.CompiledQueryProfile) QueryProfile(com.yahoo.search.query.profile.QueryProfile) QueryProfileProperties(com.yahoo.search.query.profile.QueryProfileProperties)

Example 4 with QueryProfileProperties

use of com.yahoo.search.query.profile.QueryProfileProperties 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" }));
}
Also used : CompiledQueryProfile(com.yahoo.search.query.profile.compiled.CompiledQueryProfile) QueryProfile(com.yahoo.search.query.profile.QueryProfile) QueryProfileProperties(com.yahoo.search.query.profile.QueryProfileProperties)

Example 5 with QueryProfileProperties

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

the class QueryProfileTestCase method testSettingNonLeaf4b.

public void testSettingNonLeaf4b() {
    QueryProfile p = new QueryProfile("test");
    p.setDimensions(new String[] { "x" });
    p.set("a", "a-value", (QueryProfileRegistry) null);
    p.set("a.b", "a.b-value", new String[] { "x1" }, null);
    QueryProfileProperties cp = new QueryProfileProperties(p.compile(null));
    assertEquals("a-value", cp.get("a"));
    assertNull(cp.get("a.b"));
    assertEquals("a-value", cp.get("a", new String[] { "x1" }));
    assertEquals("a.b-value", cp.get("a.b", QueryProfileVariantsTestCase.toMap(p, new String[] { "x1" })));
}
Also used : CompiledQueryProfile(com.yahoo.search.query.profile.compiled.CompiledQueryProfile) QueryProfile(com.yahoo.search.query.profile.QueryProfile) QueryProfileProperties(com.yahoo.search.query.profile.QueryProfileProperties)

Aggregations

QueryProfileProperties (com.yahoo.search.query.profile.QueryProfileProperties)25 CompiledQueryProfile (com.yahoo.search.query.profile.compiled.CompiledQueryProfile)23 QueryProfile (com.yahoo.search.query.profile.QueryProfile)21 Properties (com.yahoo.search.query.Properties)9 BackedOverridableQueryProfile (com.yahoo.search.query.profile.BackedOverridableQueryProfile)9 Properties (com.yahoo.processing.request.Properties)3 ModelObjectMap (com.yahoo.search.query.profile.ModelObjectMap)2 PropertyMap (com.yahoo.search.query.properties.PropertyMap)2 ImmutableMap (com.google.common.collect.ImmutableMap)1 CompoundName (com.yahoo.processing.request.CompoundName)1 CompiledQueryProfileRegistry (com.yahoo.search.query.profile.compiled.CompiledQueryProfileRegistry)1 QueryProfileConfigurer (com.yahoo.search.query.profile.config.QueryProfileConfigurer)1 DefaultProperties (com.yahoo.search.query.properties.DefaultProperties)1 QueryProperties (com.yahoo.search.query.properties.QueryProperties)1 RequestContextProperties (com.yahoo.search.query.properties.RequestContextProperties)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)1 Test (org.junit.Test)1