HybridSearch

public final class HybridSearch : Search

Hybrid Search module wraps online and offline search modules that conform to the Search protocol. It orchestrates how the SDK uses the two services to improve the reliability of the Search functionality.

Important

This is a Public Preview API. It may be changed or removed at any time.

Lifecycle

  • Creates a hybrid search with geopolitical view set in store.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public convenience init(
        apiKey: String,
        store: NDSStore,
        timeout: Measurement<UnitDuration> = .tt.seconds(5),
        customPOIDataProviders: [CustomPOISearchDataProvider] = [],
        customAPIURL: URL? = nil
    ) throws

    Parameters

    apiKey

    API key for the online search.

    store

    NDSStore onboard map handle.

    timeout

    the duration after which primary search results are ignored and the alternative search starts handling the query

    customPOIDataProviders

    Custom data providers for injecting external POI data into the search engine.

    customAPIURL

    Custom base URL for online APIs. Defaults to nil and “https://api.tomtom.com/search/2” will be the base URL. Can be used to change to another service that implements the same API.

Public

  • This API allows to search places and POIs meeting various criteria.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func search(options: SearchOptions, completion: @escaping (Result<SearchResponse, Error>) -> ())

    Parameters

    options

    The SearchOptions structure to limit the results.

    completion

    The completion closure is called after the response to the request has been processed. If no errors occurred, SearchResponse contains an array of search results and summary information.

  • The Autocomplete API enables you to make a more meaningful Search API call by recognizing entities inside an input query and offering them as query terms.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func autocomplete(
        options: AutocompleteOptions,
        completion: @escaping (Result<AutocompleteResponse, Error>) -> ()
    )

    Parameters

    options

    The AutocompleteOptions structure to limit the results.

    completion

    The completion closure is called after the response to the request has been processed. If no errors occurred, AutocompleteResponse contains proposed autocomplete elements, that can be used to implement an input field with the autocomplete feature.

  • This API provides a list of POI categories.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func requestPOICategories(
        options: POICategoryOptions,
        completion: @escaping (Result<POICategoryResponse, Error>) -> ()
    )

    Parameters

    options

    The POICategoryOptions structure to tune the results.

    completion

    The completion closure is called after the response to the request has been processed. If no errors occurred, POICategoryResponse contains an array of categories and subcategories together with their translations and synonyms.

  • This API provides detailed information about a POI based on its identifier (entityId).

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func requestPOIDetails(options: POIDetailsOptions, completion: @escaping (Result<POIDetailsResponse, Error>) -> ())

    Parameters

    options

    Describe what POI Details data to request.

    completion

    The completion closure is called after the response to the request has been processed. If no errors occurred, PoiDetailsResponse contains the requested search result with POI info

  • The Geometries Data API returns sets of coordinates that represent the outline of a city, country, or land area. The API supports batch requests of up to 20 identifiers.

    • options: Define geometries to request.
    • completion: Parameter completion: The completion closure is called after the response to the request has been processed. If no errors occurred, GeometryDataResponse contains an array of geometries data structures

      Note

      This API is not supported for onboard search, so the query is handled by online search only. The timeout parameter passed at HybridSearch initialization has no effect.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func requestGeometryData(
        options: GeometryDataOptions,
        completion: @escaping (Result<GeometryDataResponse, Error>) -> ()
    )
  • Asynchronously sends a feedback event for the search.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func sendFeedback(feedbackEvent: TomTomSDKSearch.FeedbackEvent, completion: ((Error?) -> ())? = nil)

    Parameters

    feedbackEvent

    The feedback event.

    completion

    If an error occurred, completion is called with error.