use of com.yahoo.vespa.model.container.search.QueryProfiles 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());
}
use of com.yahoo.vespa.model.container.search.QueryProfiles in project vespa by vespa-engine.
the class IntegerIndex2AttributeTestCase method testIntegerIndex2Attribute.
@Test
public void testIntegerIndex2Attribute() throws IOException, ParseException {
Search search = UnprocessingSearchBuilder.buildUnprocessedFromFile("src/test/examples/integerindex2attribute.sd");
search.process();
new IntegerIndex2Attribute(search, new BaseDeployLogger(), new RankProfileRegistry(), new QueryProfiles()).process(true);
SDField f;
f = search.getConcreteField("s1");
assertTrue(f.getAttributes().isEmpty());
assertTrue(f.existsIndex("s1"));
f = search.getConcreteField("s2");
assertEquals(f.getAttributes().size(), 1);
assertTrue(f.existsIndex("s2"));
f = search.getConcreteField("as1");
assertTrue(f.getAttributes().isEmpty());
assertTrue(f.existsIndex("as1"));
f = search.getConcreteField("as2");
assertEquals(f.getAttributes().size(), 1);
assertTrue(f.existsIndex("as2"));
f = search.getConcreteField("i1");
assertEquals(f.getAttributes().size(), 1);
assertTrue(!f.existsIndex("i1"));
f = search.getConcreteField("i2");
assertEquals(f.getAttributes().size(), 1);
assertTrue(!f.existsIndex("i2"));
f = search.getConcreteField("ai1");
assertEquals(search.getConcreteField("ai1").getAttributes().size(), 1);
assertTrue(!search.getConcreteField("ai1").existsIndex("ai1"));
f = search.getConcreteField("ai2");
assertEquals(f.getAttributes().size(), 1);
assertTrue(!f.existsIndex("ai2"));
}
use of com.yahoo.vespa.model.container.search.QueryProfiles in project vespa by vespa-engine.
the class QueryProfilesTestCase method assertConfig.
protected void assertConfig(String correctFileName, QueryProfileRegistry check) throws IOException {
assertSerializedConfigFileEquals(root + "/" + correctFileName, com.yahoo.text.StringUtilities.implodeMultiline(com.yahoo.config.ConfigInstance.serialize(new QueryProfiles(check).getConfig())));
// Also assert that the correct config config can actually be read as a config source
QueryProfileConfigurer configurer = new QueryProfileConfigurer("file:" + root + "empty.cfg");
configurer.shutdown();
}
use of com.yahoo.vespa.model.container.search.QueryProfiles in project vespa by vespa-engine.
the class IndexingScriptRewriterTestCase method processField.
private static ScriptExpression processField(SDField unprocessedField) {
SDDocumentType sdoc = new SDDocumentType("test");
sdoc.addField(unprocessedField);
Search search = new Search("test", null);
search.addDocument(sdoc);
Processing.process(search, new BaseDeployLogger(), new RankProfileRegistry(), new QueryProfiles(), true);
return unprocessedField.getIndexingScript();
}
use of com.yahoo.vespa.model.container.search.QueryProfiles in project vespa by vespa-engine.
the class SummaryFieldsMustHaveValidSourceTestCase method requireThatDocumentIdIsAllowedToPass.
@Test
public void requireThatDocumentIdIsAllowedToPass() throws IOException, ParseException {
Search search = UnprocessingSearchBuilder.buildUnprocessedFromFile("src/test/examples/documentidinsummary.sd");
search.process();
BaseDeployLogger deployLogger = new BaseDeployLogger();
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
new SummaryFieldsMustHaveValidSource(search, deployLogger, rankProfileRegistry, new QueryProfiles()).process(true);
assertEquals("documentid", search.getSummary("withid").getSummaryField("w").getSingleSource());
}
Aggregations