【问题标题】:Ravendb. Filter documents considered for suggestions乌鸦数据库。过滤考虑建议的文档
【发布时间】: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

【问题讨论】:

    标签: ravendb search-suggestion


    【解决方案1】:

    您不能对建议查询使用其他过滤器。 建议的工作方式是根据索引中存储的术语评估搜索词,而不考虑可能适用于那里的其他字段。

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

    【讨论】:

    • 是的,这是我的预期。但是后来这个功能真的没用了:(
    猜你喜欢
    • 2013-04-19
    • 1970-01-01
    • 2013-04-11
    • 1970-01-01
    • 1970-01-01
    • 2011-03-23
    • 1970-01-01
    • 2012-10-07
    • 1970-01-01
    相关资源
    最近更新 更多