use of com.yahoo.component.ComponentSpecification in project vespa by vespa-engine.
the class ApplicationTest method container_and_referenced_content.
/**
* Tests that an application with search chains referencing a content cluster can be constructed.
*/
@Test
public void container_and_referenced_content() throws Exception {
try (Application application = Application.fromApplicationPackage(new File("src/test/app-packages/withcontent"), Networking.disable)) {
Result result = application.getJDisc("default").search().process(new ComponentSpecification("default"), new Query("?query=substring:foobar&tracelevel=3"));
assertEquals("AND substring:fo substring:oo substring:ob substring:ba substring:ar", result.hits().get("hasQuery").getQuery().getModel().getQueryTree().toString());
}
}
use of com.yahoo.component.ComponentSpecification 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.ComponentSpecification 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.ComponentSpecification in project vespa by vespa-engine.
the class QueryProfileXMLReader method fillQueryProfileTypes.
public void fillQueryProfileTypes(List<Element> queryProfileTypeElements, QueryProfileTypeRegistry registry) {
for (Element element : queryProfileTypeElements) {
QueryProfileType type = registry.getComponent(new ComponentSpecification(element.getAttribute("id")).toId());
try {
readInheritedTypes(element, type, registry);
readFieldDefinitions(element, type, registry);
} catch (RuntimeException e) {
throw new IllegalArgumentException("Error reading " + type, e);
}
}
}
use of com.yahoo.component.ComponentSpecification in project vespa by vespa-engine.
the class QueryProfileXMLReader method fillQueryProfiles.
public void fillQueryProfiles(List<Element> queryProfileElements, QueryProfileRegistry registry) {
for (Element element : queryProfileElements) {
// Lookup by exact id
QueryProfile profile = registry.getComponent(new ComponentSpecification(element.getAttribute("id")).toId());
try {
readInherited(element, profile, registry, null, profile.toString());
readFields(element, profile, registry, null, profile.toString());
readVariants(element, profile, registry);
} catch (RuntimeException e) {
throw new IllegalArgumentException("Error reading " + profile, e);
}
}
}
Aggregations