Use ranking to display entity search results

Each entity search response includes a RankingResponse answer that tells you how to display the search results. For details about using the ranking response, see Web Search API.

Ranking response examples

The following shows an example RankingResponse object for entities.

{
  "_type": "SearchResponse",
  "queryContext": {
    "originalQuery": "Jimi Hendrix"
  },
  "entities": { ... },
  "rankingResponse": {
    "sidebar": {
      "items": [
        {
          "answerType": "Entities",
          "resultIndex": 0,
          "value": {
            "id": "https://www.bingapis.com/api/v7/#Entities.0"
          }
        },
        {
          "answerType": "Entities",
          "resultIndex": 1,
          "value": {
            "id": "https://www.bingapis.com/api/v7/#Entities.1"
          }
        }
      ]
    }
  }
}

Based on this ranking response, you'd display both entities in the sidebar.

And this example shows what the ranking response looks like for local business entities.

{
  "_type": "SearchResponse",
  "queryContext": {
    "originalQuery": "hilton near me",
    "askUserForLocation": true
  },
  "places": { ... },
  "rankingResponse": {
    "mainline": {
      "items": [
        {
          "answerType": "Places"
        },
        {
          "answerType": "Places",
          "resultIndex": 0,
          "value": {
            "id": "https://www.bingapis.com/api/v7/#Places.0"
          }
        },
        {
          "answerType": "Places",
          "resultIndex": 1,
          "value": {
            "id": "https://www.bingapis.com/api/v7/#Places.1"
          }
        },
        {
          "answerType": "Places",
          "resultIndex": 2,
          "value": {
            "id": "https://www.bingapis.com/api/v7/#Places.2"
          }
        },
        {
          "answerType": "Places",
          "resultIndex": 3,
          "value": {
            "id": "https://www.bingapis.com/api/v7/#Places.3"
          }
        },
        {
          "answerType": "Places",
          "resultIndex": 4,
          "value": {
            "id": "https://www.bingapis.com/api/v7/#Places.4"
          }
        }
      ]
    }
  }
}

Next steps