in src/main/java/com/twitter/nodes_examples/search/SearchGraph.java [134:154]
protected Future<SearchResponse> evaluate() throws Exception {
Double userScore = getDep(D.USER_SCORE);
List<Long> idList = getDep(D.RESULT_ID_LIST);
Map<Long, String> hydrationMap = getDep(D.HYDRATION_MAP);
// Create a list of results following the original order, but only keeping those
// successfully hydrated.
List<SearchResult> results = Lists.newArrayList();
for (long id : idList) {
String text = hydrationMap.get(id);
if (text != null) {
results.add(new SearchResult(id, text));
} else {
debugDetailed("Unable to create result with id=%d", id);
}
}
SearchResponse response = new SearchResponse(results, userScore);
// no delay here as this is just local non-async computation.
return Future.value(response);
}