Search in sources :

Example 6 with QueryProfileConfigurer

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"));
}
Also used : CompiledQueryProfile(com.yahoo.search.query.profile.compiled.CompiledQueryProfile) QueryProfile(com.yahoo.search.query.profile.QueryProfile) QueryProfileConfigurer(com.yahoo.search.query.profile.config.QueryProfileConfigurer) Test(org.junit.Test)

Example 7 with QueryProfileConfigurer

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)"));
}
Also used : CompiledQueryProfileRegistry(com.yahoo.search.query.profile.compiled.CompiledQueryProfileRegistry) Query(com.yahoo.search.Query) QueryProfileConfigurer(com.yahoo.search.query.profile.config.QueryProfileConfigurer) Test(org.junit.Test)

Aggregations

QueryProfileConfigurer (com.yahoo.search.query.profile.config.QueryProfileConfigurer)7 Test (org.junit.Test)5 CompiledQueryProfile (com.yahoo.search.query.profile.compiled.CompiledQueryProfile)4 Query (com.yahoo.search.Query)2 QueryProfile (com.yahoo.search.query.profile.QueryProfile)2 CompiledQueryProfileRegistry (com.yahoo.search.query.profile.compiled.CompiledQueryProfileRegistry)2 QueryProfileProperties (com.yahoo.search.query.profile.QueryProfileProperties)1 QueryProfileRegistry (com.yahoo.search.query.profile.QueryProfileRegistry)1 FieldDescription (com.yahoo.search.query.profile.types.FieldDescription)1 QueryProfileType (com.yahoo.search.query.profile.types.QueryProfileType)1 QueryProfileTypeRegistry (com.yahoo.search.query.profile.types.QueryProfileTypeRegistry)1 QueryProfiles (com.yahoo.vespa.model.container.search.QueryProfiles)1