use of io.zulia.server.search.QueryCombiner in project zuliasearch by zuliaio.
the class QueryRequestFederator method getResponse.
public QueryResponse getResponse(QueryRequest request) throws Exception {
long queryId = queryNumber.getAndIncrement();
long start = System.currentTimeMillis();
String queryJson = JsonFormat.printer().print(request);
LOG.info("Running id <" + queryId + "> query <" + queryJson + ">");
List<InternalQueryResponse> results = send(request);
QueryCombiner queryCombiner = new QueryCombiner(indexes, request, results);
QueryResponse qr = queryCombiner.getQueryResponse();
if (!queryCombiner.isShort()) {
long end = System.currentTimeMillis();
LOG.info("Finished query id <" + queryId + "> in " + (end - start) + "ms");
return qr;
} else {
if (!request.getFetchFull()) {
QueryRequest newRequest = request.toBuilder().setFetchFull(true).build();
long end = System.currentTimeMillis();
LOG.info("Finished query id <" + queryId + "> in " + (end - start) + "ms");
return getResponse(newRequest);
}
throw new Exception("Full fetch request is short");
}
}
Aggregations