【问题标题】:How to filter by Edm.DateTimeOffset in Azure Search?如何在 Azure 搜索中按 Edm.DateTimeOffset 进行筛选?
【发布时间】:2020-01-13 03:19:18
【问题描述】:

在 Azure 搜索索引搜索资源管理器中测试以下三个筛选查询字符串时,它们都返回相同的计数。看起来它根本没有过滤日期。

过滤Edm.DateTimeOffset 类型字段的正确方法是什么?

三个查询字符串测试

date_time_field eq 2010-01-01T00:00:00Z&$count=true
date_time_field lt 2010-01-01T00:00:00Z&$count=true
date_time_field ge 2010-01-01T00:00:00Z&$count=true

搜索索引中的“date_time_field”日期示例

2019-12-30T00:00:00Z
2020-01-08T11:01:13Z
2020-01-09T00:00:00Z
2019-12-30T00:00:00Z
2019-12-17T13:39:02Z

【问题讨论】:

  • 这是整个查询字符串吗?它缺少 $filter=

标签: azure-cognitive-search


【解决方案1】:

查询字符串缺少$filter=

完整且有效的查询

$filter=date_time_field eq 2010-01-01T00:00:00Z&$count=true

【讨论】:

  • 我们如何在 POST 中做同样的事情。当我在下面将 json 添加为 {"filter":"date_time_field eq 2010-01-01T00:00:00Z"} 时,它会给出错误:{ "error": { "code": "", "message": "The request is invalid. Details: parameters : Invalid JSON. Unexpected end of input was found in JSON content. Not all object and array scopes were closed.\r\n" } } 看起来其他类型工作正常,DateTimeOffset 似乎是导致问题的原因。有什么想法吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-05-11
  • 2020-05-20
  • 1970-01-01
  • 2020-12-14
  • 1970-01-01
  • 2021-11-02
  • 2020-04-10
相关资源
最近更新 更多