【问题标题】:Azure Search Service search integersAzure 搜索服务搜索整数
【发布时间】:2018-12-14 18:19:20
【问题描述】:

如果你有一个简单的索引:

public partial class SomeIndex
{
    [Key]
    [IsFilterable]
    public string Id{ get; set; }

    [IsSearchable, IsFilterable, IsSortable]
    public string Name{ get; set; }

    [IsFilterable, IsSortable]
    public int SomeNumber { get; set; }

如何搜索 SomeNumber int 的确切数字匹配项?

'eq' 不适用于此处。

任何建议表示赞赏。谢谢你。

【问题讨论】:

  • 您是否尝试过创建 OData 过滤器查询?
  • 正如我上面提到的,带有 'eq' 的查询将找不到匹配项。
  • 我刚刚尝试在索引中使用整数类型字段,它工作得非常好。我直接使用了 REST API。我想知道你为什么说它找不到任何匹配项。
  • @tom33pr 这与您的问题无关,但您应该将数字字段建模为 int 类型?不是int。否则 null 值将无法正确反序列化。

标签: azure search odata azure-cognitive-search azure-search-.net-sdk


【解决方案1】:

您可以使用过滤器。 'eq' 完美运行。

过滤查询将是'字段名称eq数字'

唯一的限制是该字段必须是可过滤的

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-02-14
    • 1970-01-01
    • 1970-01-01
    • 2019-03-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-31
    相关资源
    最近更新 更多