如何在 SharePoint 搜索 API 中使用 > 和 < 运算符?

How to use > and < operators in SharePoint search API?

我正在使用 SharePoint 搜索 API 并引用 link SharePoint Search REST API overview. I want to use property operators. Please refer 'Property operators that are supported in property restrictions' section in link Keyword Query Language (KQL) syntax reference

我正在形成查询 http://server/_api/search/query?querytext='AmountCurrency > 10.50'&selectproperties='Title,Author'

同样http://server/_api/search/query?querytext='AmountNumber < 20.50'&selectproperties='Title,Author'

在上面的查询中,AmountCurrency 和 AmountNumber 分别是 Currency 列和 Number 列的托管属性。但是搜索 api 没有返回任何行。对我来说 : 和 = 运算符工作正常。如何在搜索中使用大于和小于运算符 API?

确保您使用的字段名称已在搜索架构的托管属性中定义。

或者您可以使用 SharePoint Search Query Tool 构建查询。

知道了。这是由于托管 属性 类型。以下是我们创建托管属性时可用的类型。

  • 文字
  • 整数
  • 十进制
  • 日期和时间
  • Yes/No
  • 双精度浮点数
  • 二进制

当自动为网站栏创建托管 属性 时,默认类型为文本。手动创建托管 属性 时,只有 Search Service Application 管理员可以选择任何类型。所有其他用户可以选择文本或 Yes/No.

我不是 SSA 管理员。所以我使用了默认未使用的托管属性。请参考https://technet.microsoft.com/en-us/library/jj219667.aspx#Anchor_8。使用 RefinableDecimal00RefinableDecimal01 并将适当的抓取 属性 映射到它们。现在一切正常