How to Filter Search Results by Type in HERE Geocoding and Search API

Applies To
----------

HERE Geocoding and Search API (v7)
Endpoints: /discover, /autosuggest

---

Summary
-------

When using the HERE Geocoding and Search API, search responses may include a mix of places, addresses, and query suggestions. To improve relevance and precision, you can filter results by specific types using supported query parameters.

---

Answer
------

Use the types parameter (for /discover) or resultTypes parameter (for /autosuggest) to restrict search results to specific categories such as places, addresses, or query suggestions.

This allows you to control the structure of the response and tailor results to your application’s needs.

---

Symptoms
--------

You may observe:

Mixed search results containing both places and addresses
Irrelevant results for your use case
Difficulty retrieving only a specific type of result (e.g., only POIs or only cities)

---

Root Cause
----------

By default, the Geocoding and Search API returns a combination of:

Place results (Points of Interest)
Address results (street, city, postal code, etc.)
Query suggestions (for autosuggest requests)

Without applying filters, the API does not limit results to a specific category.

---

Solution
--------

### 1. Filter for Place (POI) Results Only

Use the types=place parameter with the /discover endpoint:

<br />https://discover.search.hereapi.com/v1/discover?q=virginia&at=33.70907,-117.95028&types=place&apiKey=YOUR_API_KEY<br />

This returns only place (POI) results and excludes address results.

---

### 2. Filter for Address Results

To return only specific address components:

<br />types=street,city,houseNumber<br />

Common address-related types include:

street
city
houseNumber
postalCode
state, county, country

These filters allow you to limit results to specific administrative or address levels.

---

### 3. Filter Query Suggestions (Autosuggest Endpoint)

When using the /autosuggest endpoint, use the resultTypes parameter:

<br />https://autosuggest.search.hereapi.com/v1/autosuggest?q=mac&at=33.70907,-117.95028&resultTypes=chainQuery&apiKey=YOUR_API_KEY<br />

Supported result types include:

chainQuery (e.g., brand names)
categoryQuery (e.g., restaurant categories)

This helps restrict suggestions to specific query types.

---

Impact
------

| Scenario | Result |
| --- | --- |
| No filtering applied | Mixed result types returned |
| Filtering by types or resultTypes | Only relevant result categories returned |

Filtering improves:

Search precision
Relevance of results
Simplicity of client-side processing

---

Recommended Actions
-------------------

Use types=place for POI-focused applications
Use address-related types for geocoding and address validation
Use resultTypes with /autosuggest for suggestion-based user interfaces
Combine filters with location constraints (at, in) for best results

---

Expected Behavior
-----------------

| Situation | Expected |
| --- | --- |
| No types parameter | Mixed results (places, addresses, suggestions) |
| types=place | Only place results returned |
| Address types specified | Only address results returned |
| resultTypes used in autosuggest | Suggestions limited to selected types |

---

Notes
-----

The types parameter applies to the /discover endpoint
The resultTypes parameter applies to the /autosuggest endpoint
Filtering helps optimize both user experience and application performance
Not all result types are supported in every endpoint

---

Related Information
-------------------

HERE Documentation: https://docs.here.com
HERE Geocoding and Search API: https://docs.here.com/geocoding-and-search/docs/here-geocoding-and-search-api-v7-endpoints
* HERE Support Portal: https://support.here.com

---

Keywords
--------

Geocoding and Search API, types parameter, result filtering, place search, autosuggest, resultTypes, HERE API