Commands: Querying: How to work with Suggestion query?

To take advantage of a suggestion feature use the Suggest method from the commands.

Syntax

public SuggestionQueryResult suggest(String index, SuggestionQuery suggestionQuery);
Parameters
index String A name of an index to query.
suggestionQuery SuggestionQuery A suggestion query definition containing all information required to query a specified index.
Return Value
SuggestionQueryResult Result containing an array of all suggestions for executed query

Example

// Get suggestions for 'johne' using 'FullName' field in 'Users/ByFullName' index
SuggestionQuery suggestionQuery = new SuggestionQuery();
suggestionQuery.setField("FullName");
suggestionQuery.setTerm("johne");
suggestionQuery.setMaxSuggestions(10);
SuggestionQueryResult result = store.getDatabaseCommands().suggest("Users/ByFullName", suggestionQuery);

System.out.println("Did you mean?");

for (String suggestion: result.getSuggestions()) {
  System.out.println("\t" + suggestion);
}
// Did you mean?
//      john
//      jones
//      johnson