You are currently browsing legacy 3.0 version of documentation. Click here to switch to the newest 5.1 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 method contains extensions (Suggest) that allow you to use suggestion feature.


SuggestionQueryResult Suggest(
	this IQueryable queryable) { ... }

SuggestionQueryResult Suggest(
	this IQueryable queryable,
	SuggestionQuery query) { ... }
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.


SuggestionQueryResult suggestions = session
	.Query<Employee, Employees_ByFullName>()
		new SuggestionQuery
				Field = "FullName",
				Term = "johne",
				Accuracy = 0.4f,
				MaxSuggestions = 5,
				Distance = StringDistanceTypes.JaroWinkler,
				Popularity = true,