use of com.yahoo.search.query.properties.SubProperties in project vespa by vespa-engine.
the class FederationSearcher method getSourceProperties.
/**
* Returns the set of properties set for the source or provider given in the query (if any).
*
* If the query has not set sourceName or providerName, null will be returned
*/
public static Properties getSourceProperties(Query query) {
String sourceName = query.properties().getString(SOURCENAME);
String providerName = query.properties().getString(PROVIDERNAME);
if (sourceName == null || providerName == null)
return null;
Properties sourceProperties = new SubProperties("source." + sourceName, query.properties());
Properties providerProperties = new SubProperties("provider." + providerName, query.properties());
sourceProperties.chain(providerProperties);
return sourceProperties;
}
use of com.yahoo.search.query.properties.SubProperties in project vespa by vespa-engine.
the class SubPropertiesTestCase method testSubProperties.
@Test
public void testSubProperties() {
PropertyMap map = new PropertyMap() {
{
set("a.e", "1");
set("a.f", 2);
set("b.e", "3");
set("f", 3);
set("e", "2");
set("d", "a");
}
};
SubProperties sub = new SubProperties("a", map);
assertEquals("1", sub.get("e"));
assertEquals(2, sub.get("f"));
assertNull(sub.get("d"));
assertEquals(new HashSet<>(Arrays.asList("e", "f")), sub.listProperties("").keySet());
}
Aggregations