Azure Search; Search inside a specific field

五迷三道 提交于 2019-12-11 16:45:01

问题


In Azure Search can i do searching on specific field(s)

Example: I have the below "Research" Index.

{
  "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
  }
} 

Now in the search query can I ask Azure to search only in the "Questions" field?

E.g. When user search for "How Internet of things benefits automotive industry?" and selects i want to find this in only "Questions" would i able to do that.


回答1:


Yes, this is possible using the searchFields=[string] parameter. For example, in your case you would add &searchFields=Questions to your URL search request. You can learn more about this here: https://msdn.microsoft.com/en-us/library/azure/dn798927.aspx



来源:https://stackoverflow.com/questions/28441033/azure-search-search-inside-a-specific-field

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!