【问题标题】:Filter RavenDB query by entries of list按列表条目过滤 RavenDB 查询
【发布时间】:2020-02-19 12:28:00
【问题描述】:

我正在使用 ravendb 的 python 客户端

我的目标是在DateTime的一定范围内选择唯一的Types和他们的TypeCount

目前我有以下 Map 和 Reduce:

这给了我以下结果:

现在我希望能够在某个DateTime 范围内选择它。例如,如果我们只考虑 BTE 类型,如果我要说类似 where Dates > "2020-02-09" 的内容,我想得到以下结果: Type = BTE, TypeCount = 2, Dates = ["2020-02-09T00:50:07.0000890", "2020-02-09T00:59:41.0000210"

【问题讨论】:

    标签: python date indexing ravendb raven


    【解决方案1】:

    可以通过去掉索引的Reduce部分,将Dates改成Date = pds.DateTime,这样就可以查询索引了:

    var queryResult = session.Query<Index.Result, Index>()
                            .Where(x => x.Type == "BTE" && x.Date > new DateTime(2020, 2, 9))
                            .ToList();
    

    【讨论】:

    • 感谢您的回答,但我认为这不是我想要的答案。我想使用减少的索引来减少查询时间。如果我没看错,我会在您的解决方案中使用普通索引,并且会回到平方 1。
    猜你喜欢
    • 1970-01-01
    • 2016-05-22
    • 2021-11-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-12-22
    • 1970-01-01
    • 2018-10-15
    相关资源
    最近更新 更多