You are currently browsing legacy 3.0 version of documentation. Click here to switch to the newest 5.0 version.

We can help you with migration to the latest RavenDB

Contact Us Now
see on GitHub

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.
Return Value
SuggestionQueryResult Result containing array of all suggestions for executed query.

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();