use of com.yahoo.search.query.profile.config.QueryProfileXMLReader in project vespa by vespa-engine.
the class XmlReadingTestCase method testNewsFE2.
@Test
public void testNewsFE2() {
CompiledQueryProfileRegistry registry = new QueryProfileXMLReader().read("src/test/java/com/yahoo/search/query/profile/config/test/newsfe2").compile();
String queryString = "tiled?query=a&intl=tw&mode=adv&mode=adv";
Query query = new Query(HttpRequest.createTestRequest(queryString, Method.GET), registry.getComponent("default"));
assertEquals("news_adv", query.properties().listProperties().get("provider"));
assertEquals("news_adv", query.properties().get("provider"));
}
use of com.yahoo.search.query.profile.config.QueryProfileXMLReader in project vespa by vespa-engine.
the class XmlReadingTestCase method testNewsCase4.
// Should cause an exception on the first line as we are trying to create a profile setting an illegal value in "ranking"
@Test
public void testNewsCase4() {
CompiledQueryProfileRegistry registry = new QueryProfileXMLReader().read("src/test/java/com/yahoo/search/query/profile/config/test/newscase4").compile();
Query query;
query = new Query(HttpRequest.createTestRequest("?query=test&custid_1=parent", Method.GET), registry.getComponent("default"));
assertEquals("0.0", query.properties().get("ranking.features"));
query = new Query(HttpRequest.createTestRequest("?query=test&custid_1=parent&custid_2=child", Method.GET), registry.getComponent("default"));
assertEquals("0.1", query.properties().get("ranking.features"));
}
use of com.yahoo.search.query.profile.config.QueryProfileXMLReader in project vespa by vespa-engine.
the class XmlReadingTestCase method testInvalid1.
@Test
public void testInvalid1() {
try {
new QueryProfileXMLReader().read("src/test/java/com/yahoo/search/query/profile/config/test/invalidxml1");
fail("Should have failed");
} catch (IllegalArgumentException e) {
assertEquals("Error reading query profile 'illegalSetting' of type 'native': Could not set 'model.notDeclared' to 'value': 'notDeclared' is not declared in query profile type 'model', and the type is strict", Exceptions.toMessageString(e));
}
}
Aggregations