use of com.yahoo.component.ComponentId in project vespa by vespa-engine.
the class JDiscContainerDocprocTest method requireThatLaterDocumentProcessingWorks.
@Test
public void requireThatLaterDocumentProcessingWorks() throws Exception {
try (Application app = new ApplicationBuilder().servicesXml(getXML(CHAIN_NAME, Rot13DocumentProcessor.class.getCanonicalName())).networking(Networking.disable).documentType("music", DOCUMENT).build()) {
JDisc container = app.getJDisc("container");
DocumentProcessing docProc = container.documentProcessing();
DocumentType type = docProc.getDocumentTypes().get("music");
ChainRegistry<DocumentProcessor> chains = docProc.getChains();
assertTrue(chains.allComponentsById().containsKey(new ComponentId(CHAIN_NAME)));
Document doc = new Document(type, "doc:this:is:a:great:album");
doc.setFieldValue("title", "Great Album!");
com.yahoo.docproc.Processing processing;
DocumentProcessor.Progress progress;
DocumentPut put = new DocumentPut(doc);
processing = com.yahoo.docproc.Processing.of(put);
progress = docProc.processOnce(ComponentSpecification.fromString(CHAIN_NAME), processing);
assertThat(progress, instanceOf(DocumentProcessor.LaterProgress.class));
assertThat(doc.getFieldValue("title").toString(), equalTo("Great Album!"));
progress = docProc.processOnce(ComponentSpecification.fromString(CHAIN_NAME), processing);
assertThat(progress, instanceOf(DocumentProcessor.LaterProgress.class));
assertThat(doc.getFieldValue("title").toString(), equalTo("Great Album!"));
progress = docProc.processOnce(ComponentSpecification.fromString(CHAIN_NAME), processing);
assertThat(progress, sameInstance(DocumentProcessor.Progress.DONE));
assertThat(doc.getFieldValue("title").toString(), equalTo("Terng Nyohz!"));
}
}
use of com.yahoo.component.ComponentId in project vespa by vespa-engine.
the class ContainerCluster method addMbusServer.
public void addMbusServer(ComponentId chainId) {
ComponentId serviceId = chainId.nestInNamespace(ComponentId.fromString("MbusServer"));
addComponent(new Component<>(new ComponentModel(new BundleInstantiationSpecification(serviceId, ComponentSpecification.fromString(MbusServerProvider.class.getName()), null))));
}
use of com.yahoo.component.ComponentId in project vespa by vespa-engine.
the class ContainerDocumentApi method setupLegacySearchers.
private void setupLegacySearchers(ContainerCluster cluster) {
Set<ComponentSpecification> inherited = new TreeSet<>();
SearchChain vespaGetChain = new SearchChain(new ChainSpecification(new ComponentId("vespaget"), new ChainSpecification.Inheritance(inherited, null), new ArrayList<>(), new TreeSet<>()));
vespaGetChain.addInnerComponent(newVespaClientSearcher("com.yahoo.storage.searcher.GetSearcher"));
SearchChain vespaVisitChain = new SearchChain(new ChainSpecification(new ComponentId("vespavisit"), new ChainSpecification.Inheritance(inherited, null), new ArrayList<>(), new TreeSet<>()));
vespaVisitChain.addInnerComponent(newVespaClientSearcher("com.yahoo.storage.searcher.VisitSearcher"));
SearchChains chains;
if (cluster.getSearch() != null) {
chains = cluster.getSearchChains();
} else {
chains = new SearchChains(cluster, "searchchain");
}
chains.add(vespaGetChain);
chains.add(vespaVisitChain);
if (cluster.getSearch() == null) {
ContainerSearch containerSearch = new ContainerSearch(cluster, chains, new ContainerSearch.Options());
cluster.setSearch(containerSearch);
ProcessingHandler<SearchChains> searchHandler = new ProcessingHandler<>(chains, "com.yahoo.search.handler.SearchHandler");
searchHandler.addServerBindings("http://*/search/*", "https://*/search/*");
cluster.addComponent(searchHandler);
}
}
use of com.yahoo.component.ComponentId in project vespa by vespa-engine.
the class LocalProvider method disableStemmingIfStreaming.
// TODO: ugly, restructure this
private Set<ComponentSpecification> disableStemmingIfStreaming(Set<ComponentSpecification> searcherReferences) {
if (!searchCluster.isStreaming()) {
return searcherReferences;
} else {
Set<ComponentSpecification> filteredSearcherReferences = new LinkedHashSet<>(searcherReferences);
filteredSearcherReferences.remove(toGlobalComponentId(new ComponentId("com.yahoo.prelude.querytransform.StemmingSearcher")).toSpecification());
return filteredSearcherReferences;
}
}
use of com.yahoo.component.ComponentId in project vespa by vespa-engine.
the class RankProfileTestCase method setupQueryProfileTypes.
private static QueryProfileRegistry setupQueryProfileTypes() {
QueryProfileRegistry registry = new QueryProfileRegistry();
QueryProfileTypeRegistry typeRegistry = registry.getTypeRegistry();
QueryProfileType type = new QueryProfileType(new ComponentId("testtype"));
type.addField(new FieldDescription("ranking.features.query(tensor1)", FieldType.fromString("tensor(x[10])", typeRegistry)), typeRegistry);
type.addField(new FieldDescription("ranking.features.query(tensor2)", FieldType.fromString("tensor(y{})", typeRegistry)), typeRegistry);
type.addField(new FieldDescription("ranking.features.invalid(tensor3)", FieldType.fromString("tensor(x{})", typeRegistry)), typeRegistry);
type.addField(new FieldDescription("ranking.features.query(numeric)", FieldType.fromString("integer", typeRegistry)), typeRegistry);
typeRegistry.register(type);
return registry;
}
Aggregations