You are currently browsing legacy 3.5 version of documentation. Click here to switch to the newest 5.2 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();