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. |
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,
});