You are currently browsing legacy 3.0 version of documentation. Click here to switch to the newest 5.1 version.
Session: Querying: How to work with suggestions?
query allows you to use suggestion feature.
public SuggestionQueryResult suggest(); public SuggestionQueryResult suggest(SuggestionQuery query);
|query||SuggestionQuery||A suggestion query definition containing all information required to query a specified index.|
|SuggestionQueryResult||Result containing array of all suggestions for executed query.|
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();