Result scoring

The /geocode endpoint returns scoring information, which indicates for each result how good it matches to the original query. This can be used by the end user application to accept or reject the results depending on how “expensive” is the mistake for their use case.

A free-form text query for address 240 Washington St., Boston is formulated with the following:

GET https://geocode.search.hereapi.com/v1/
    geocode
    ?q=240+Washington+St.%2C+Boston

Authorization: Bearer [your token]

The address is correct, has no mistakes or typos and does not contain anything not relevant for addressing.

The response to the above request looks like the following:

{
  "items": [
    {
      "title": "240 Washington St, Boston, MA 02108-4603, United States",
      "id": "here:af:streetsection:YCY1nQWrJ5eBrHv075VVOD:CggIBCDns4LfAhABGgMyNDAoZA",
      "resultType": "houseNumber",
      "houseNumberType": "PA",
      "address": {
        "label": "240 Washington St, Boston, MA 02108-4603, United States",
        "countryCode": "USA",
        "countryName": "United States",
        "state": "Massachusetts",
        "county": "Suffolk",
        "city": "Boston",
        "district": "Downtown Boston",
        "street": "Washington St",
        "postalCode": "02108-4603",
        "houseNumber": "240"
      },
      "position": {
        "lat": 42.35814,
        "lng": -71.05765
      },
      "access": [
        {
          "lat": 42.35815,
          "lng": -71.05788
        }
      ],
      "mapView": {
        "west": -71.05887,
        "south": 42.35724,
        "east": -71.05643,
        "north": 42.35904
      },
      "scoring": {
        "queryScore": 1,
        "fieldScore": {
          "city": 1,
          "streets": [
            1
          ],
          "houseNumber": 1
        }
      }
    },
    {
      "title": "240 Washington St, Boston, MA 02135-3508, United States",
      "id": "here:af:streetsection:6SnFDsUujYAamxhLX-Vr1D:CgcIBCDRnLAhEAEaAzI0MChk",
      "resultType": "houseNumber",
      "houseNumberType": "PA",
      "address": {
        "label": "240 Washington St, Boston, MA 02135-3508, United States",
        "countryCode": "USA",
        "countryName": "United States",
        "state": "Massachusetts",
        "county": "Suffolk",
        "city": "Boston",
        "district": "Brighton Center",
        "street": "Washington St",
        "postalCode": "02135-3508",
        "houseNumber": "240"
      },
      "position": {
        "lat": 42.34754,
        "lng": -71.14943
      },
      "access": [
        {
          "lat": 42.34765,
          "lng": -71.14925
        }
      ],
      "mapView": {
        "west": -71.15065,
        "south": 42.34664,
        "east": -71.14821,
        "north": 42.34844
      },
      "scoring": {
        "queryScore": 1,
        "fieldScore": {
          "city": 1,
          "streets": [
            1
          ],
          "houseNumber": 1
        }
      }
    }
  ]
}

The results includes scoring block, which consists of two parts:

  • queryScore – a value from 0 to 1 representing the percentage of the input that matched the returned address. It is equal to 1 if all input tokens were recognized and matched. If the input query contains any additional information – name of the person, phone number or a hint to ring twice – the queryScore will be low, but the result may be correct. But low queryScore may indicate that the result does not match some relevant part of the address in the input query.
  • fieldScore – values from 0 to 1 indicating how good the result field matches to the corresponding part of the query. If all the fields that are important for addressing in the country are matched with high quality, one can assume, that queryScore is low because of the additional non-address information. And the result is still confident.

More details about /geocode parameters can be found in the API Reference.

results matching ""

    No results matching ""