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);
}
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);
}
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"));
}
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"));
}
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");
}
Aggregations