HybridSearchFactory

public enum HybridSearchFactory

This is the factory for accessing the implementations for the Hybrid Search APIs provided via the Search protocol. The 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.

An example usage:

// Create and store a Hybrid Search instance.
self.search = try HybridSearchFactory.create(apiKey: "YOUR_API_KEY", store: store)

// Perform a search operation.
let options = SearchOptions(query: "pizza")
search.search(options) { result in /* Here you do processing */ }

Note

for more details, see the Search documentation.

Important

This is a Public Preview API. It may be changed or removed at any time.
  • Creates a hybrid search with the geopolitical view set in store.

    Throws

    Throws an error if NDSStore is invalid.

    Important

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

    Declaration

    Swift

    public static func create(
        apiKey: String,
        store: NDSStore,
        timeout: Measurement<UnitDuration> = .tt.seconds(5),
        customPOIProviders: [CustomPOIProvider] = [],
        customAPIURL: URL? = nil
    ) throws
        -> Search

    Parameters

    apiKey

    API key for the online search.

    store

    NDSStore offline map handle. Additionally, NDSStore defines the overall geopolitical view for both online and offline in HybridSearch. Configure the corresponding geopolitical view in NDSStoreConfiguration and initialize NDSStore with it.

    timeout

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

    customPOIProviders

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

    customAPIURL

    This is the custom base URL for online APIs. It defaults to nil, and “https://api.tomtom.com/search/2” will be the base URL. It can be used to change to another service that implements the same API.

    Return Value

    Returns an instance that implements Search with hybrid search support and the geopolitical view set in store.