Search in sources :

Example 11 with QueryProfileRegistry

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

the class QueryProfileVariantsTestCase method testVariantsOfExplicitCompoundWithVariantReference.

@Test
public void testVariantsOfExplicitCompoundWithVariantReference() throws IOException {
    QueryProfileRegistry registry = new QueryProfileRegistry();
    QueryProfile a1 = new QueryProfile("a1");
    a1.set("b", "a1.b", registry);
    QueryProfile a2 = new QueryProfile("a2");
    a2.set("b", "a2.b", registry);
    QueryProfile profile = new QueryProfile("test");
    profile.setDimensions(new String[] { "x" });
    profile.set("a", a1, registry);
    profile.set("a", a2, new String[] { "x1" }, registry);
    profile.set("a.b", "a.b.x1", new String[] { "x1" }, registry);
    profile.set("a.b", "a.b.x2", new String[] { "x2" }, registry);
    registry.register(a1);
    registry.register(a2);
    registry.register(profile);
    QueryProfiles profiles = new QueryProfiles(registry);
    assertSerializedConfigFileEquals(root + "variants-of-explicit-compound-with-reference.cfg", profiles.getConfig().toString());
}
Also used : QueryProfile(com.yahoo.search.query.profile.QueryProfile) QueryProfiles(com.yahoo.vespa.model.container.search.QueryProfiles) QueryProfileRegistry(com.yahoo.search.query.profile.QueryProfileRegistry) Test(org.junit.Test)

Example 12 with QueryProfileRegistry

use of com.yahoo.search.query.profile.QueryProfileRegistry 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 13 with QueryProfileRegistry

use of com.yahoo.search.query.profile.QueryProfileRegistry 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 14 with QueryProfileRegistry

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

the class QueryProfileVariantsTestCase method testVariantsOfExplicitCompound.

@Test
public void testVariantsOfExplicitCompound() throws IOException {
    QueryProfileRegistry registry = new QueryProfileRegistry();
    QueryProfile a1 = new QueryProfile("a1");
    a1.set("b", "a1.b", registry);
    QueryProfile profile = new QueryProfile("test");
    profile.setDimensions(new String[] { "x" });
    profile.set("a", a1, registry);
    profile.set("a.b", "a.b.x1", new String[] { "x1" }, registry);
    profile.set("a.b", "a.b.x2", new String[] { "x2" }, registry);
    registry.register(a1);
    registry.register(profile);
    QueryProfiles profiles = new QueryProfiles(registry);
    assertSerializedConfigFileEquals(root + "variants-of-explicit-compound.cfg", profiles.getConfig().toString());
}
Also used : QueryProfile(com.yahoo.search.query.profile.QueryProfile) QueryProfiles(com.yahoo.vespa.model.container.search.QueryProfiles) QueryProfileRegistry(com.yahoo.search.query.profile.QueryProfileRegistry) Test(org.junit.Test)

Example 15 with QueryProfileRegistry

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

the class IncorrectRankingExpressionFileRefTestCase method testIncorrectRef.

@Test
public void testIncorrectRef() throws IOException, ParseException {
    try {
        RankProfileRegistry registry = new RankProfileRegistry();
        Search search = SearchBuilder.buildFromFile("src/test/examples/incorrectrankingexpressionfileref.sd", registry, new QueryProfileRegistry());
        // cause rank profile parsing
        new DerivedConfiguration(search, registry, new QueryProfileRegistry());
        fail("parsing should have failed");
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
        assertTrue(e.getCause().getMessage().contains("Could not read ranking expression file"));
        assertTrue(e.getCause().getMessage().contains("wrongending.expr.expression"));
    }
}
Also used : DerivedConfiguration(com.yahoo.searchdefinition.derived.DerivedConfiguration) QueryProfileRegistry(com.yahoo.search.query.profile.QueryProfileRegistry) Test(org.junit.Test)

Aggregations

QueryProfileRegistry (com.yahoo.search.query.profile.QueryProfileRegistry)68 Test (org.junit.Test)38 QueryProfile (com.yahoo.search.query.profile.QueryProfile)24 CompiledQueryProfileRegistry (com.yahoo.search.query.profile.compiled.CompiledQueryProfileRegistry)16 RawRankProfile (com.yahoo.searchdefinition.derived.RawRankProfile)16 QueryProfileType (com.yahoo.search.query.profile.types.QueryProfileType)14 Query (com.yahoo.search.Query)11 AttributeFields (com.yahoo.searchdefinition.derived.AttributeFields)11 QueryProfiles (com.yahoo.vespa.model.container.search.QueryProfiles)11 Pair (com.yahoo.collections.Pair)8 QueryProfileXMLReader (com.yahoo.search.query.profile.config.QueryProfileXMLReader)8 Search (com.yahoo.searchdefinition.Search)8 FieldDescription (com.yahoo.search.query.profile.types.FieldDescription)7 RankProfileRegistry (com.yahoo.searchdefinition.RankProfileRegistry)7 BaseDeployLogger (com.yahoo.config.model.application.provider.BaseDeployLogger)6 SDDocumentType (com.yahoo.searchdefinition.document.SDDocumentType)6 SDField (com.yahoo.searchdefinition.document.SDField)5 ComponentId (com.yahoo.component.ComponentId)4 CompiledQueryProfile (com.yahoo.search.query.profile.compiled.CompiledQueryProfile)4 QueryProfileTypeRegistry (com.yahoo.search.query.profile.types.QueryProfileTypeRegistry)4