use of com.yahoo.vespa.model.container.search.searchchain.SearchChain 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.vespa.model.container.search.searchchain.SearchChain in project vespa by vespa-engine.
the class ContainerIncludeTest method include.
@Test
public void include() {
VespaModelCreatorWithFilePkg creator = new VespaModelCreatorWithFilePkg("src/test/cfg/container/data/containerinclude/");
VespaModel model = creator.create();
assertThat(model.getContainerClusters().size(), is(1));
ContainerCluster cluster = model.getContainerClusters().values().iterator().next();
assertThat(cluster.getSearchChains(), notNullValue());
Map<String, SearchChain> searchChainMap = new HashMap<>();
for (SearchChain searchChain : cluster.getSearchChains().allChains().allComponents()) {
searchChainMap.put(searchChain.getId().stringValue(), searchChain);
}
assertThat(searchChainMap.get("searchchain1"), notNullValue());
assertThat(searchChainMap.get("searchchain1").getInnerComponents().size(), is(1));
assertThat(searchChainMap.get("searchchain1").getInnerComponents().iterator().next().getComponentId().stringValue(), is("com.yahoo.Searcher1"));
assertThat(searchChainMap.get("searchchain2"), notNullValue());
assertThat(searchChainMap.get("searchchain2").getInnerComponents().size(), is(1));
assertThat(searchChainMap.get("searchchain2").getInnerComponents().iterator().next().getComponentId().stringValue(), is("com.yahoo.Searcher2"));
assertThat(searchChainMap.get("searchchain3"), notNullValue());
assertThat(searchChainMap.get("searchchain3").getInnerComponents().size(), is(1));
assertThat(searchChainMap.get("searchchain3").getInnerComponents().iterator().next().getComponentId().stringValue(), is("com.yahoo.Searcher3"));
assertThat(searchChainMap.get("searchchain4"), notNullValue());
assertThat(searchChainMap.get("searchchain4").getInnerComponents().size(), is(1));
assertThat(searchChainMap.get("searchchain4").getInnerComponents().iterator().next().getComponentId().stringValue(), is("com.yahoo.Searcher4"));
assertThat(cluster.getDocprocChains(), notNullValue());
Map<String, DocprocChain> docprocChainMap = new HashMap<>();
for (DocprocChain docprocChain : cluster.getDocprocChains().allChains().allComponents()) {
docprocChainMap.put(docprocChain.getId().stringValue(), docprocChain);
}
assertThat(docprocChainMap.get("docprocchain1"), notNullValue());
assertThat(docprocChainMap.get("docprocchain1").getInnerComponents().size(), is(1));
assertThat(docprocChainMap.get("docprocchain1").getInnerComponents().iterator().next().getComponentId().stringValue(), is("com.yahoo.DocumentProcessor1"));
assertThat(docprocChainMap.get("docprocchain2"), notNullValue());
assertThat(docprocChainMap.get("docprocchain2").getInnerComponents().size(), is(1));
assertThat(docprocChainMap.get("docprocchain2").getInnerComponents().iterator().next().getComponentId().stringValue(), is("com.yahoo.DocumentProcessor2"));
assertThat(cluster.getProcessingChains(), notNullValue());
Map<String, ProcessingChain> processingChainMap = new HashMap<>();
for (ProcessingChain processingChain : cluster.getProcessingChains().allChains().allComponents()) {
processingChainMap.put(processingChain.getId().stringValue(), processingChain);
}
assertThat(processingChainMap.get("processingchain1"), notNullValue());
assertThat(processingChainMap.get("processingchain1").getInnerComponents().size(), is(1));
assertThat(processingChainMap.get("processingchain1").getInnerComponents().iterator().next().getComponentId().stringValue(), is("com.yahoo.Processor1"));
assertThat(processingChainMap.get("processingchain2"), notNullValue());
assertThat(processingChainMap.get("processingchain2").getInnerComponents().size(), is(1));
assertThat(processingChainMap.get("processingchain2").getInnerComponents().iterator().next().getComponentId().stringValue(), is("com.yahoo.Processor2"));
}
Aggregations