use of org.obiba.mica.search.CountStatsDtoBuilders.NetworkCountStatsBuilder in project mica2 by obiba.
the class NetworkQuery method processHits.
@Override
public void processHits(QueryResultDto.Builder builder, Searcher.DocumentResults results, QueryScope scope, CountStatsData counts) throws IOException {
NetworkResultDto.Builder resBuilder = NetworkResultDto.newBuilder();
NetworkCountStatsBuilder networkCountStatsBuilder = counts == null ? null : NetworkCountStatsBuilder.newBuilder(counts);
Consumer<Network> addDto = networkConsumer(scope, resBuilder, networkCountStatsBuilder);
List<Network> networks = Lists.newArrayList();
for (Searcher.DocumentResult result : results.getDocuments()) {
if (result.hasSource())
networks.add(objectMapper.readValue(result.getSourceInputStream(), Network.class));
}
networks.forEach(addDto);
builder.setExtension(NetworkResultDto.result, resBuilder.build());
}
Aggregations