Azure搜索;在特定字段内搜索

时间:2015-02-10 20:21:39

标签: c# .net search azure-search

在Azure搜索中,我可以搜索特定字段

示例:我有以下“研究”索引。

{
  "Error": null,
  "IsSuccess": true,
  "StatusCode": 201,
  "Body": {
    "name": "Research",
    "fields": [
      {
        "name": "Id",
        "type": "Edm.String",
        "searchable": false,
        "filterable": false,
        "sortable": false,
        "facetable": false,
        "suggestions": false,
        "key": true,
        "retrievable": true
      },
      {
        "name": "Title",
        "type": "Edm.String",
        "searchable": true,
        "filterable": false,
        "sortable": false,
        "facetable": false,
        "suggestions": true,
        "key": false,
        "retrievable": true
      },
      {
        "name": "Description",
        "type": "Edm.String",
        "searchable": true,
        "filterable": false,
        "sortable": false,
        "facetable": false,
        "suggestions": true,
        "key": false,
        "retrievable": true
      },
      {
        "name": "Questions",
        "type": "Collection(Edm.String)",
        "searchable": true,
        "filterable": false,
        "sortable": false,
        "facetable": false,
        "suggestions": true,
        "key": false,
        "retrievable": true
      },
    ],
    "scoringProfiles": [],
    "defaultScoringProfile": null,
    "corsOptions": null
  }
} 

现在在搜索查询中,我可以要求Azure只在“问题”字段中搜索吗?

E.g。当用户搜索“物联网如何使汽车行业受益?”时并选择我想在“问题”中找到这个我能做到的。

1 个答案:

答案 0 :(得分:3)

是的,可以使用searchFields=[string]参数。例如,在您的情况下,您可以将&searchFields=Questions添加到您的网址搜索请求中。您可以在此处了解详情:https://msdn.microsoft.com/en-us/library/azure/dn798927.aspx