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?
Session Query
method contains extensions (Suggest
) that allow you to use suggestion feature.
Syntax
SuggestionQueryResult Suggest(
this IQueryable queryable) { ... }
SuggestionQueryResult Suggest(
this IQueryable queryable,
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
SuggestionQueryResult suggestions = session
.Query<Employee, Employees_ByFullName>()
.Suggest(
new SuggestionQuery
{
Field = "FullName",
Term = "johne",
Accuracy = 0.4f,
MaxSuggestions = 5,
Distance = StringDistanceTypes.JaroWinkler,
Popularity = true,
});