use of com.yahoo.search.federation.sourceref.UnresolvedSearchChainException in project vespa by vespa-engine.
the class FederationSearcher method search.
@Override
public Result search(Query query, Execution execution) {
Result mergedResults = execution.search(query);
Results<SearchChainInvocationSpec, UnresolvedSearchChainException> targets = getTargets(query.getModel().getSources(), query.properties(), execution.context().getIndexFacts());
warnIfUnresolvedSearchChains(targets.errors(), mergedResults.hits());
Collection<SearchChainInvocationSpec> prunedTargets = pruneTargetsWithoutDocumentTypes(query.getModel().getRestrict(), targets.data());
Results<Target, ErrorMessage> regularTargetHandlers = resolveSearchChains(prunedTargets, execution.searchChainRegistry());
query.errors().addAll(regularTargetHandlers.errors());
Set<Target> targetHandlers = new LinkedHashSet<>(regularTargetHandlers.data());
targetHandlers.addAll(getAdditionalTargets(query, execution, targetSelector));
traceTargets(query, targetHandlers);
if (targetHandlers.isEmpty())
return mergedResults;
else if (targetHandlers.size() > 1)
search(query, execution, targetHandlers, mergedResults);
else if (shouldExecuteTargetLongerThanThread(query, targetHandlers.iterator().next()))
// one target, but search in separate thread
search(query, execution, targetHandlers, mergedResults);
else
// search in this thread
search(query, execution, first(targetHandlers), mergedResults);
return mergedResults;
}
Aggregations