Skip to content

Commit

Permalink
PLT-191: atlas search: method level
Browse files Browse the repository at this point in the history
  • Loading branch information
n5nk committed Nov 10, 2023
1 parent 48b00be commit 0769262
Showing 1 changed file with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1042,18 +1042,19 @@ private void prepareSearchResult(AtlasSearchResult ret, DirectIndexQueryResult i
if(LOG.isDebugEnabled()){
LOG.debug("Preparing search results for ({})", ret.getSearchParameters());
}

Stream<Result> resultStream = StreamSupport.stream(Spliterators.spliteratorUnknownSize(indexQueryResult.getIterator(), Spliterator.ORDERED), true);
Map<Long, Result> vertexIds = resultStream.collect(Collectors.toMap(Result::getId, result -> result));
List<AtlasVertex> resultVertices = graph.getVertices(vertexIds.keySet().toArray());
List<AtlasEntityHeader> headers = resultVertices.parallelStream().map(v -> {
try {
return enrichVertex(ret, resultAttributes, vertexIds.get(v.getId()), v, fetchCollapsedResults);
} catch (AtlasBaseException e) {
throw new RuntimeException(e);
}
}).collect(Collectors.toList());
headers.forEach(ret::addEntity);
if (indexQueryResult.getIterator().hasNext()) {
Stream<Result> resultStream = StreamSupport.stream(Spliterators.spliteratorUnknownSize(indexQueryResult.getIterator(), Spliterator.ORDERED), true);
Map<Long, Result> vertexIds = resultStream.collect(Collectors.toMap(Result::getId, result -> result));
List<AtlasVertex> resultVertices = graph.getVertices(vertexIds.keySet().toArray());
List<AtlasEntityHeader> headers = resultVertices.parallelStream().map(v -> {
try {
return enrichVertex(ret, resultAttributes, vertexIds.get(v.getId()), v, fetchCollapsedResults);
} catch (AtlasBaseException e) {
throw new RuntimeException(e);
}
}).collect(Collectors.toList());
headers.forEach(ret::addEntity);
}
} catch (Exception e) {
throw e;
}
Expand Down

0 comments on commit 0769262

Please sign in to comment.