Ravendb。过滤考虑建议的文件

问题描述 投票:1回答:1

我想使用建议查询和过滤文档来考虑几个字段的建议。它甚至可能吗?我在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

ravendb search-suggestion
1个回答
1
投票

您无法在建议查询中使用其他过滤器。建议的工作方式是,它针对索引中存储的术语评估搜索项,而不考虑可能适用于其他字段的其他字段。

您可以使用构面,根据其他过滤器进行过滤,并使用建议输出作为构面的输入。

© www.soinside.com 2019 - 2024. All rights reserved.