【发布时间】:2019-04-22 21:09:54
【问题描述】:
我想使用建议查询和过滤文档来考虑几个字段的建议。甚至可能吗?我在 ravendb 文档 link to doc
中找不到任何相关信息我尝试将过滤条件添加到可查询但没有成功
using (IDocumentSession documentSession = _storeProvider.GetStore().OpenSession())
{
var queryable = documentSession.Query<SearchableProduct>("SearchableProducts");
var result = queryable
//I would like to filter by this field!
.Where(m => m.BrandNo == query.BrandNumber)
.Suggest(new SuggestionQuery
{
Term = query.SearchTerm,
Accuracy = 0.4f,
Field = nameof(SearchableProduct.ProductName),
MaxSuggestions = 10,
Distance = (StringDistanceTypes)2,
Popularity = true
});
return result.Suggestions;
}
Ravendb 版本:3.0
【问题讨论】: