use of com.yahoo.component.ComponentId in project vespa by vespa-engine.
the class ExecutionTestCase method testLinearExecutions.
public void testLinearExecutions() {
// Make a chain
List<Searcher> searchers1 = new ArrayList<>();
searchers1.add(new TestSearcher("searcher1"));
searchers1.add(new TestSearcher("searcher2"));
searchers1.add(new TestSearcher("searcher3"));
searchers1.add(new TestSearcher("searcher4"));
Chain<Searcher> chain1 = new Chain<>(new ComponentId("chain1"), searchers1);
// Make another chain containing two of the same searcher instances and two new
List<Searcher> searchers2 = new ArrayList<>(searchers1);
searchers2.set(1, new TestSearcher("searcher5"));
searchers2.set(3, new TestSearcher("searcher6"));
Chain<Searcher> chain2 = new Chain<>(new ComponentId("chain2"), searchers2);
// Execute both
Query query = new Query("test");
Result result1 = new Execution(chain1, Execution.Context.createContextStub()).search(query);
Result result2 = new Execution(chain2, Execution.Context.createContextStub()).search(query);
// Verify results
assertEquals(4, result1.getConcreteHitCount());
assertNotNull(result1.hits().get("searcher1-1"));
assertNotNull(result1.hits().get("searcher2-1"));
assertNotNull(result1.hits().get("searcher3-1"));
assertNotNull(result1.hits().get("searcher4-1"));
assertEquals(4, result2.getConcreteHitCount());
assertNotNull(result2.hits().get("searcher1-2"));
assertNotNull(result2.hits().get("searcher5-1"));
assertNotNull(result2.hits().get("searcher3-2"));
assertNotNull(result2.hits().get("searcher6-1"));
}
use of com.yahoo.component.ComponentId in project vespa by vespa-engine.
the class QueryProfileTypeTestCase method setUp.
@Override
protected void setUp() {
registry = new QueryProfileRegistry();
type = new QueryProfileType(new ComponentId("testtype"));
type.inherited().add(registry.getTypeRegistry().getComponent(new ComponentId("native")));
typeStrict = new QueryProfileType(new ComponentId("testtypeStrict"));
typeStrict.setStrict(true);
user = new QueryProfileType(new ComponentId("user"));
userStrict = new QueryProfileType(new ComponentId("userStrict"));
userStrict.setStrict(true);
registry.getTypeRegistry().register(type);
registry.getTypeRegistry().register(typeStrict);
registry.getTypeRegistry().register(user);
registry.getTypeRegistry().register(userStrict);
addTypeFields(type, registry.getTypeRegistry());
type.addField(new FieldDescription("myUserQueryProfile", FieldType.fromString("query-profile:user", registry.getTypeRegistry())));
addTypeFields(typeStrict, registry.getTypeRegistry());
typeStrict.addField(new FieldDescription("myUserQueryProfile", FieldType.fromString("query-profile:userStrict", registry.getTypeRegistry())));
addUserFields(user, registry.getTypeRegistry());
addUserFields(userStrict, registry.getTypeRegistry());
}
use of com.yahoo.component.ComponentId in project vespa by vespa-engine.
the class ProcessingFactory method createConcreteDocument.
private Document createConcreteDocument(Document document, ContainerDocumentConfig.Doctype typeConfig) {
// Class name of the factory
String componentId = typeConfig.factorycomponent();
AbstractConcreteDocumentFactory cdf = docFactoryRegistry.getComponent(new ComponentId(componentId));
if (cdf == null) {
log.fine("Unable to get document factory component '" + componentId + "' from document factory registry.");
return document;
}
return cdf.getDocumentCopy(document.getDataType().getName(), document, document.getId());
}
Aggregations