Session: Querying: How to work with suggestions?
Session query
allows you to use suggestion feature.
Syntax
public SuggestionQueryResult suggest();
public SuggestionQueryResult suggest(SuggestionQuery query);
Parameters |
|
|
query |
SuggestionQuery |
A suggestion query definition containing all information required to query a specified index. |
Example
SuggestionQuery suggestionQuery = new SuggestionQuery("FullName", "johne");
suggestionQuery.setAccuracy(0.4f);
suggestionQuery.setMaxSuggestions(5);
suggestionQuery.setDistance(StringDistanceTypes.JARO_WINKLER);
suggestionQuery.setPopularity(true);
SuggestionQueryResult suggestions = session
.query(Employee.class, Employees_ByFullName.class)
.suggest();