Search in sources :

Example 46 with QueryProfileRegistry

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

the class QueryProfilesTestCase method testEmpty.

@Test
public void testEmpty() throws IOException {
    QueryProfileRegistry reg = new QueryProfileRegistry();
    assertConfig("empty.cfg", reg);
}
Also used : QueryProfileRegistry(com.yahoo.search.query.profile.QueryProfileRegistry) CompiledQueryProfileRegistry(com.yahoo.search.query.profile.compiled.CompiledQueryProfileRegistry) Test(org.junit.Test)

Example 47 with QueryProfileRegistry

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

the class LiteralBoostTestCase method testTwoLiteralBoostFields.

/**
 * Tests literal boosts in two fields going to the same index
 */
@Test
public void testTwoLiteralBoostFields() {
    Search search = new Search("msb", null);
    RankProfileRegistry rankProfileRegistry = RankProfileRegistry.createRankProfileRegistryWithBuiltinRankProfiles(search);
    SDDocumentType document = new SDDocumentType("msb");
    search.addDocument(document);
    SDField field1 = document.addField("title", DataType.STRING);
    field1.parseIndexingScript("{ summary | index }");
    field1.setLiteralBoost(20);
    SDField field2 = document.addField("body", DataType.STRING);
    field2.parseIndexingScript("{ summary | index }");
    field2.setLiteralBoost(20);
    search = SearchBuilder.buildFromRawSearch(search, rankProfileRegistry, new QueryProfileRegistry());
    new DerivedConfiguration(search, rankProfileRegistry, new QueryProfileRegistry());
    assertIndexing(Arrays.asList("clear_state | guard { input title | tokenize normalize stem:\"SHORTEST\" | summary title | index title; }", "clear_state | guard { input body | tokenize normalize stem:\"SHORTEST\" | summary body | index body; }", "clear_state | guard { input title | tokenize | index title_literal; }", "clear_state | guard { input body | tokenize | index body_literal; }"), search);
}
Also used : RankProfileRegistry(com.yahoo.searchdefinition.RankProfileRegistry) SDField(com.yahoo.searchdefinition.document.SDField) SDDocumentType(com.yahoo.searchdefinition.document.SDDocumentType) Search(com.yahoo.searchdefinition.Search) QueryProfileRegistry(com.yahoo.search.query.profile.QueryProfileRegistry) Test(org.junit.Test)

Example 48 with QueryProfileRegistry

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

the class LiteralBoostTestCase method testNonDefaultRankLiteralBoost.

/**
 * Tests adding a literal boost in a non-default rank profile only
 */
@Test
public void testNonDefaultRankLiteralBoost() {
    Search search = new Search("literalboost", null);
    RankProfileRegistry rankProfileRegistry = RankProfileRegistry.createRankProfileRegistryWithBuiltinRankProfiles(search);
    SDDocumentType document = new SDDocumentType("literalboost");
    search.addDocument(document);
    SDField field1 = document.addField("a", DataType.STRING);
    field1.parseIndexingScript("{ index }");
    RankProfile other = new RankProfile("other", search, rankProfileRegistry);
    rankProfileRegistry.addRankProfile(other);
    other.addRankSetting(new RankProfile.RankSetting("a", RankProfile.RankSetting.Type.LITERALBOOST, 333));
    search = SearchBuilder.buildFromRawSearch(search, rankProfileRegistry, new QueryProfileRegistry());
    DerivedConfiguration derived = new DerivedConfiguration(search, rankProfileRegistry, new QueryProfileRegistry());
    // Check il script addition
    assertIndexing(Arrays.asList("clear_state | guard { input a | tokenize normalize stem:\"SHORTEST\" | index a; }", "clear_state | guard { input a | tokenize | index a_literal; }"), search);
    // Check index info addition
    IndexInfo indexInfo = derived.getIndexInfo();
    assertTrue(indexInfo.hasCommand("a", "literal-boost"));
}
Also used : RankProfileRegistry(com.yahoo.searchdefinition.RankProfileRegistry) SDField(com.yahoo.searchdefinition.document.SDField) SDDocumentType(com.yahoo.searchdefinition.document.SDDocumentType) Search(com.yahoo.searchdefinition.Search) QueryProfileRegistry(com.yahoo.search.query.profile.QueryProfileRegistry) RankProfile(com.yahoo.searchdefinition.RankProfile) Test(org.junit.Test)

Example 49 with QueryProfileRegistry

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

the class TypeConversionTestCase method testExactStringToStringTypeConversion.

/**
 * Tests that exact-string stuff is not spilled over to the default index
 */
@Test
public void testExactStringToStringTypeConversion() {
    Search search = new Search("test", null);
    RankProfileRegistry rankProfileRegistry = RankProfileRegistry.createRankProfileRegistryWithBuiltinRankProfiles(search);
    SDDocumentType document = new SDDocumentType("test");
    search.addDocument(document);
    SDField a = new SDField("a", DataType.STRING);
    a.parseIndexingScript("{ index }");
    document.addField(a);
    Processing.process(search, new BaseDeployLogger(), rankProfileRegistry, new QueryProfiles(), true);
    DerivedConfiguration derived = new DerivedConfiguration(search, rankProfileRegistry, new QueryProfileRegistry());
    IndexInfo indexInfo = derived.getIndexInfo();
    assertFalse(indexInfo.hasCommand("default", "compact-to-term"));
}
Also used : RankProfileRegistry(com.yahoo.searchdefinition.RankProfileRegistry) SDField(com.yahoo.searchdefinition.document.SDField) SDDocumentType(com.yahoo.searchdefinition.document.SDDocumentType) BaseDeployLogger(com.yahoo.config.model.application.provider.BaseDeployLogger) Search(com.yahoo.searchdefinition.Search) QueryProfiles(com.yahoo.vespa.model.container.search.QueryProfiles) QueryProfileRegistry(com.yahoo.search.query.profile.QueryProfileRegistry) Test(org.junit.Test)

Example 50 with QueryProfileRegistry

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

the class RankPropertyVariablesTestCase method testRankPropVariables.

@Test
public void testRankPropVariables() throws IOException, ParseException {
    RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
    Search search = SearchBuilder.buildFromFile("src/test/examples/rankpropvars.sd", new BaseDeployLogger(), rankProfileRegistry, new QueryProfileRegistry());
    assertRankPropEquals(rankProfileRegistry.getRankProfile(search, "other").getRankProperties(), "$testvar1", "foo");
    assertRankPropEquals(rankProfileRegistry.getRankProfile(search, "other").getRankProperties(), "$testvar_2", "bar");
    assertRankPropEquals(rankProfileRegistry.getRankProfile(search, "other").getRankProperties(), "$testvarOne23", "baz");
    assertRankPropEquals(rankProfileRegistry.getRankProfile(search, "another").getRankProperties(), "$Testvar1", "1");
    assertRankPropEquals(rankProfileRegistry.getRankProfile(search, "another").getRankProperties(), "$Testvar_4", "4");
    assertRankPropEquals(rankProfileRegistry.getRankProfile(search, "another").getRankProperties(), "$testvarFour23", "234234.234");
}
Also used : RankProfileRegistry(com.yahoo.searchdefinition.RankProfileRegistry) BaseDeployLogger(com.yahoo.config.model.application.provider.BaseDeployLogger) Search(com.yahoo.searchdefinition.Search) 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