Search in sources :

Example 1 with QueryProfileXMLReader

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

the class QueryProfileVariantsTestCase method testConfigCreationNewsBESimple.

@Test
public void testConfigCreationNewsBESimple() throws IOException {
    QueryProfileRegistry registry = new QueryProfileXMLReader().read(root + "newsbesimple");
    QueryProfiles profiles = new QueryProfiles(registry);
    assertSerializedConfigFileEquals(root + "newsbe-query-profiles-simple.cfg", profiles.getConfig().toString());
}
Also used : QueryProfiles(com.yahoo.vespa.model.container.search.QueryProfiles) QueryProfileRegistry(com.yahoo.search.query.profile.QueryProfileRegistry) QueryProfileXMLReader(com.yahoo.search.query.profile.config.QueryProfileXMLReader) Test(org.junit.Test)

Example 2 with QueryProfileXMLReader

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

the class QueryProfileVariantsTestCase method testConfigCreation.

@Test
public void testConfigCreation() throws IOException {
    QueryProfileRegistry registry = new QueryProfileXMLReader().read(root + "queryprofilevariants");
    QueryProfiles profiles = new QueryProfiles(registry);
    assertSerializedConfigFileEquals(root + "query-profile-variants-configuration.cfg", profiles.getConfig().toString());
}
Also used : QueryProfiles(com.yahoo.vespa.model.container.search.QueryProfiles) QueryProfileRegistry(com.yahoo.search.query.profile.QueryProfileRegistry) QueryProfileXMLReader(com.yahoo.search.query.profile.config.QueryProfileXMLReader) Test(org.junit.Test)

Example 3 with QueryProfileXMLReader

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

the class QueryProfileVariantsTestCase method testConfigCreationNewsFESimple.

@Test
public void testConfigCreationNewsFESimple() throws IOException {
    QueryProfileRegistry registry = new QueryProfileXMLReader().read(root + "newsfesimple");
    QueryProfiles profiles = new QueryProfiles(registry);
    assertSerializedConfigFileEquals(root + "newsfe-query-profiles-simple.cfg", profiles.getConfig().toString());
}
Also used : QueryProfiles(com.yahoo.vespa.model.container.search.QueryProfiles) QueryProfileRegistry(com.yahoo.search.query.profile.QueryProfileRegistry) QueryProfileXMLReader(com.yahoo.search.query.profile.config.QueryProfileXMLReader) Test(org.junit.Test)

Example 4 with QueryProfileXMLReader

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

the class XmlReadingTestCase method testNewsCase2.

@Test
public void testNewsCase2() {
    CompiledQueryProfileRegistry registry = new QueryProfileXMLReader().read("src/test/java/com/yahoo/search/query/profile/config/test/newscase2").compile();
    Query query;
    query = new Query(HttpRequest.createTestRequest("?query=test&custid_1=parent", Method.GET), registry.getComponent("default"));
    assertEquals("0.0", query.properties().get("a.features.b"));
    assertEquals("0.0", query.properties().listProperties().get("a.features.b"));
    query = new Query(HttpRequest.createTestRequest("?query=test&custid_1=parent&custid_2=child", Method.GET), registry.getComponent("default"));
    assertEquals("0.1", query.properties().get("a.features.b"));
    assertEquals("0.1", query.properties().listProperties().get("a.features.b"));
}
Also used : CompiledQueryProfileRegistry(com.yahoo.search.query.profile.compiled.CompiledQueryProfileRegistry) Query(com.yahoo.search.Query) QueryProfileXMLReader(com.yahoo.search.query.profile.config.QueryProfileXMLReader) Test(org.junit.Test)

Example 5 with QueryProfileXMLReader

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

the class XmlReadingTestCase method testNewsCase3.

@Test
public void testNewsCase3() {
    CompiledQueryProfileRegistry registry = new QueryProfileXMLReader().read("src/test/java/com/yahoo/search/query/profile/config/test/newscase3").compile();
    Query query;
    query = new Query(HttpRequest.createTestRequest("?query=test&custid_1=parent", Method.GET), registry.getComponent("default"));
    assertEquals("0.0", query.properties().get("a.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("a.features"));
}
Also used : CompiledQueryProfileRegistry(com.yahoo.search.query.profile.compiled.CompiledQueryProfileRegistry) Query(com.yahoo.search.Query) QueryProfileXMLReader(com.yahoo.search.query.profile.config.QueryProfileXMLReader) Test(org.junit.Test)

Aggregations

QueryProfileXMLReader (com.yahoo.search.query.profile.config.QueryProfileXMLReader)23 Test (org.junit.Test)21 CompiledQueryProfileRegistry (com.yahoo.search.query.profile.compiled.CompiledQueryProfileRegistry)14 Query (com.yahoo.search.Query)13 QueryProfileRegistry (com.yahoo.search.query.profile.QueryProfileRegistry)8 CompiledQueryProfile (com.yahoo.search.query.profile.compiled.CompiledQueryProfile)5 QueryProfiles (com.yahoo.vespa.model.container.search.QueryProfiles)4 HttpRequest (com.yahoo.container.jdisc.HttpRequest)3 QueryProfile (com.yahoo.search.query.profile.QueryProfile)3 HashMap (java.util.HashMap)2 Map (java.util.Map)2 CompoundName (com.yahoo.processing.request.CompoundName)1 Properties (com.yahoo.search.query.Properties)1 FieldDescription (com.yahoo.search.query.profile.types.FieldDescription)1 QueryProfileType (com.yahoo.search.query.profile.types.QueryProfileType)1 File (java.io.File)1