use of com.yahoo.search.query.profile.config.QueryProfileConfigurer in project vespa by vespa-engine.
the class QueryProfileConfigurationTestCase method testConfiguration.
@Test
public void testConfiguration() {
QueryProfileConfigurer configurer = new QueryProfileConfigurer("file:" + CONFIG_DIR + "query-profiles-configuration.cfg");
QueryProfile profile = configurer.getCurrentRegistry().getComponent("default");
assertEquals("a-value", profile.get("a"));
assertEquals("b-value", profile.get("b"));
assertEquals("c.d-value", profile.get("c.d"));
assertFalse(profile.isDeclaredOverridable("c.d", null));
assertEquals("e-value-inherited1", profile.get("e"));
// Even though we make an explicit reference to one not having this value, we still inherit it
assertEquals("g.d2-value-inherited1", profile.get("g.d2"));
assertEquals("a-value-subprofile1", profile.get("sub1.a"));
assertEquals("c.d-value-subprofile1", profile.get("sub1.c.d"));
assertEquals("a-value-subprofile2", profile.get("sub2.a"));
assertEquals("c.d-value-subprofile2", profile.get("sub2.c.d"));
assertEquals("e-value-subprofile3", profile.get("g.e"));
}
use of com.yahoo.search.query.profile.config.QueryProfileConfigurer in project vespa by vespa-engine.
the class QueryProfileConfigurationTestCase method testVariant2ConfigurationThroughQueryLookup.
@Test
public void testVariant2ConfigurationThroughQueryLookup() {
QueryProfileConfigurer configurer = new QueryProfileConfigurer("file:" + CONFIG_DIR + "query-profile-variants2.cfg");
CompiledQueryProfileRegistry registry = configurer.getCurrentRegistry().compile();
Query query = new Query(QueryTestCase.httpEncode("?query=heh&queryProfile=multi&myindex=default&myquery=lo ve&tracelevel=5"), registry.findQueryProfile("multi"));
assertEquals("love", query.properties().get("model.queryString"));
assertEquals("default", query.properties().get("model.defaultIndex"));
assertEquals("-20", query.properties().get("ranking.features.query(scorelimit)"));
assertEquals("-20", query.getRanking().getFeatures().get("query(scorelimit)"));
query.properties().set("rankfeature.query(scorelimit)", -30);
assertEquals("-30", query.properties().get("ranking.features.query(scorelimit)"));
assertEquals("-30", query.getRanking().getFeatures().get("query(scorelimit)"));
}
Aggregations