use of com.yelp.nrtsearch.server.grpc.OneSuggestLookupResponse in project nrtsearch by Yelp.
the class YelpSuggestTest method main.
// Run with args host && port && remote tmp dir in order
public static void main(String[] args) throws Exception {
// The dir where the indices will live in the remote server
Path yelp_suggest_test_base_path = Paths.get(System.getProperty("suggestTmp"));
// The client who will be talking to the remote server
LuceneServerClient standaloneServerClient = new LuceneServerClient(System.getProperty("suggestHost"), Integer.parseInt(System.getProperty("suggestPort")));
setUpIndex(standaloneServerClient, INDEX_NAME, SUGGESTIONS_FILE_PATH, new YelpSuggestTest.OneDocBuilderImpl());
// build Suggester
buildSuggester(standaloneServerClient);
// look up suggestions
SuggestLookupRequest.Builder suggestLookupBuilder = SuggestLookupRequest.newBuilder();
suggestLookupBuilder.setIndexName(INDEX_NAME);
suggestLookupBuilder.setText("a");
suggestLookupBuilder.setSuggestName("suggest_0");
suggestLookupBuilder.setHighlight(true);
// Set SF lat lon lookup
List<String> sanFranGeohashes = getGeoHashes(37.785371, -122.459446, 5, 7);
for (String geohash : sanFranGeohashes) {
suggestLookupBuilder.addContexts(geohash);
}
SuggestLookupResponse suggestResponse = standaloneServerClient.getBlockingStub().suggestLookup(suggestLookupBuilder.build());
List<OneSuggestLookupResponse> suggestResponseResultsList = suggestResponse.getResultsList();
System.out.println(suggestResponseResultsList);
System.exit(0);
}
Aggregations