in src/main/java/com/twitter/nodes_examples/search/SearchExampleMain.java [40:69]
public static void main(String[] args) {
// Enable debugging, this is both for the collection of debug info and also for enabling the
// DOT visualization.
DebugManager.update(new DebugMessageBuilder(DebugLevel.DEBUG_DETAILED));
// Create the input and the graph
SearchRequest request = new SearchRequest("query", 10, 777L);
SearchGraph searchGraph = new SearchGraph(Node.value(request));
// Actually start execution
Future<SearchResponse> responseFuture = searchGraph.responseNode.apply();
// Wait for response and print results
try {
SearchResponse response = Await.result(responseFuture);
System.out.println("Search response: " + response);
} catch (Exception e) {
LOG.warning("Exception thrown while waiting for results: " + e);
}
// Print the debug information
System.out.println("Debug output:\n" + DebugManager.getDebugMessage());
// Produce dependency graph visualization
try {
Files.write(searchGraph.toDotGraph().getBytes(), new File("graph.dot"));
} catch (IOException e) {
LOG.warning("Cannot write to local file");
}
}