Skip to main content

Search

Navigation SDK UX Framework comes with a built-in search experience, which can be customized according to your needs. For example you can hide the panel with search categories in free drive state. You can also change number of results displayed in full screen and category search.

Additionally, you can configure the entrance mode for the search screen by entranceMode argument. Pass a specific argument:

  • SearchEntranceMode.RECENT - to open search screen from recent history tab
  • SearchEntranceMode.SEARCH - to open search screen focused in input area with opened keyboard if it is available
Dash.init(
applicationContext = applicationContext,
accessToken = getString(R.string.mapbox_access_token)
) {
search {
querySearchLimit = 5
categorySearchLimit = 24
entranceMode = SearchEntranceMode.SEARCH // Default value is: SearchEntranceMode.RECENT
}
}

It is also possible to update search options in runtime:

Dash.applyUpdate {
search {
querySearchLimit = 5
categorySearchLimit = 24
}
}

Search engine

Search configuration allows a customer to adapt the existing Mapbox search results to their custom needs or even completely override them with own search data through these capabilities:

  • overriding search data provider on the client side
  • enriching the mapbox search result list with its own search results based on the domain logic, as in user visited location and so on.
  • changing ordering of the results in the list to create a ranking that meets their needs.
  • updating search result attributes or enriching them, with additional metadata.

To start using custom search engine pass implementation of the search engine into the configuration:

search {
searchEngine = CustomSearchEngine()
}

The DashSearchEngine interface defines a customizable search engine that can override the default search behavior based on a specified policy.

Properties

processingPolicy: DashSearchEnginePolicy - Defines how search results should be handled.

Options:

  • DashSearchEnginePolicy.OVERRIDE_ONLY - Return only the overridden results.
  • DashSearchEnginePolicy.OVERRIDE_WITH_DEFAULT - Return overridden results along with results from the default search API.

Functions

search(request: DashSearchRequest, options: DashSearchOptions): List<DashSearchSuggestion>

Performs a search based on the given request and options. Returns a list of search suggestions (DashSearchSuggestion).

Parameters:

  • request: DashSearchRequest - The search request containing the query and other parameters.
  • options: DashSearchOptions - Additional search options.

Returns:

List<DashSearchSuggestion> - A list of search suggestions matching the query.

categorySearch(searchRequest: DashSearchRequest, displayName: String, options: DashCategorySearchOptions): List<DashSearchResult>

Performs a category-specific search based on the given searchRequest, displayName, and options. Returns a list of search results.

Parameters:

  • searchRequest: DashSearchRequest - The search request containing the query and other parameters.
  • displayName: String - The display name of the category.
  • options: DashCategorySearchOptions - Additional options for category search.

Returns:

List<DashSearchResult> - A list of search results within the specified category.

Was this page helpful?