use of com.yahoo.component.ComponentId in project vespa by vespa-engine.
the class ApplicationStatusHandlerTest method chains_are_rendered.
@Test
public void chains_are_rendered() throws Exception {
ChainRegistry<Processor> chains = new ChainRegistry<>();
Chain<Processor> chain = new Chain<Processor>("myChain", new VoidProcessor(new ComponentId("voidProcessor")));
chains.register(new ComponentId("myChain"), chain);
String json = ApplicationStatusHandler.StatusResponse.renderChains(chains).toString();
assertThat(json, containsString("myChain"));
assertThat(json, containsString("voidProcessor"));
}
use of com.yahoo.component.ComponentId in project vespa by vespa-engine.
the class ComponentRegistryTestCase method testInnerComponentNotMixedWithTopLevelComponent.
@Test
public void testInnerComponentNotMixedWithTopLevelComponent() {
assertNull(registry.getComponent(componentName));
TestComponent topLevel = new TestComponent(new ComponentId(componentName));
registry.register(topLevel.getId(), topLevel);
assertEquals(topLevel, registry.getComponent(componentName));
assertEquals(component1, registry.getComponent(specInNamespace(namespace1)));
assertEquals(component1, registry.getComponent(idInNamespace(namespace1)));
}
use of com.yahoo.component.ComponentId in project vespa by vespa-engine.
the class FederationSearcher method createFederationQuery.
private Query createFederationQuery(Query query, Query outgoing, Window window, long timeout, Target target) {
ComponentId chainId = target.getChain().getId();
String sourceName = chainId.getName();
outgoing.properties().set(SOURCENAME, sourceName);
String providerName = chainId.getName();
if (chainId.getNamespace() != null)
providerName = chainId.getNamespace().getName();
outgoing.properties().set(PROVIDERNAME, providerName);
outgoing.setTimeout(timeout);
switch(propagateSourceProperties) {
case ALL:
propagatePerSourceQueryProperties(query, outgoing, window, sourceName, providerName, QueryProperties.PER_SOURCE_QUERY_PROPERTIES);
break;
case OFFSET_HITS:
propagatePerSourceQueryProperties(query, outgoing, window, sourceName, providerName, new CompoundName[] { Query.OFFSET, Query.HITS });
break;
}
// TODO: FederationTarget
// TODO: only for target produced by this, not others
target.modifyTargetQuery(outgoing);
return outgoing;
}
use of com.yahoo.component.ComponentId in project vespa by vespa-engine.
the class FederationSearcher method mergeResult.
private void mergeResult(Query query, Target target, Result mergedResults, Result result) {
target.modifyTargetResult(result);
ComponentId searchChainId = target.getId();
Chain<Searcher> searchChain = target.getChain();
mergedResults.mergeWith(result);
HitGroup group = result.hits();
group.setId("source:" + searchChainId.getName());
group.setSearcherSpecificMetaData(this, searchChain);
// Set hit groups as non-meta as a default
group.setMeta(false);
// Set hit group as auxiliary so that it doesn't contribute to count
group.setAuxiliary(true);
group.setSource(searchChainId.getName());
group.setQuery(result.getQuery());
for (Iterator<Hit> it = group.unorderedDeepIterator(); it.hasNext(); ) {
Hit hit = it.next();
hit.setSearcherSpecificMetaData(this, searchChain);
hit.setSource(searchChainId.stringValue());
// See HTTPBackendSearcher, where this hit is created
if (hit.isMeta() && hit.types().contains("logging")) {
// Augment this hit with count fields
hit.setField(LOG_COUNT_PREFIX + "deep", result.getDeepHitCount());
hit.setField(LOG_COUNT_PREFIX + "total", result.getTotalHitCount());
int offset = result.getQuery().getOffset();
hit.setField(LOG_COUNT_PREFIX + "first", offset + 1);
hit.setField(LOG_COUNT_PREFIX + "last", result.getConcreteHitCount() + offset);
}
}
if (query.getTraceLevel() >= 4)
query.trace("Got " + group.getConcreteSize() + " hits from " + group.getId(), false, 4);
mergedResults.hits().add(group);
}
use of com.yahoo.component.ComponentId in project vespa by vespa-engine.
the class RendererRegistry method addTemplateSet.
@SuppressWarnings({ "deprecation", "unchecked" })
private ComponentId addTemplateSet(UserTemplate<?> templateSet) {
Renderer renderer = new SearchRendererAdaptor(templateSet);
ComponentId rendererId = new ComponentId(templateSet.getName());
renderer.initId(rendererId);
register(rendererId, renderer);
return rendererId;
}
Aggregations