Configure the Woosmap MultiSearch iOS SDK

Explore available parameters and understand how to combine the different autocomplete services on iOS

API options

For each API configuration you can apply the same optional parameters as defined in the dedicated REST API’s documentation.

Documentation:

Configuring a Provider

A provider is a wrapper around a Woosmap API or a Google API which will be called to return the result for a query or get details of a place. Each provider must be created from a provider configuration and this provider must then be passed to MultiSearch object by calling MultiSearch.addProvider method.

To tell the MultiSearch which autocomplete service you would like to implement, create new provider configuration object.

swift
        ProviderConfig(searchType: SearchProviderType, key: String, fallbackBreakpoint: Double? = nil, minInputLength: Int? = nil, param: ConfigParam? = nil) 

    

Required Parameters

  • searchType: Type of the provider. Passed as SearchProviderType enum.
  • key: Your project’s private key. This key identifies your Woosmap Project for purposes of quota management.

Optional Parameters

  • fallbackBreakpoint: A number between 0 and 1 corresponding to the threshold of fallback.
  • minInputLength: minimum input length before executing autocomplete provider.
  • param (type ConfigParam): to bias the API and search for specific regions or languages. Check each provider to see available parameters.

ConfigParam class.

This class helps to collect all query parameter required for api calls to fine tune results Example for Localities creating ConfigParam with components, types, tags, language:

swift
        ConfigParam(components: Components? = nil, types: [String]? = nil, language: String? = nil, query: String? = nil, data: DataFormat? = nil, extended: String? = nil  ) 

    

Woosmap Address Provider

To create a configuration for Woosmap Address provider use the search type parameter SearchProviderType.address:

swift
        let addressProvider = ProviderConfig(searchType: .address, 
                                            key: woosmapPrivateKey)

    

Available Provider parameters

  • components: to filter over countries.
  • language: in which language the results should be returned. Searches are also biased to the selected language.
  • fields: to limit content of responses to the geometry part.

Example Woosmap Address Provider

swift
        let addressProvider = ProviderConfig(searchType: .address,
                                     key: woosmapPrivateKey,
                                     fallbackBreakpoint: 0.8,
                                     minInputLength: 1,
                                     param: ConfigParam(
                                                 components: Components(country: ["FR"]),
                                                 language: "fr"))

    

Woosmap Localities Provider

To create a configuration for Woosmap Localities provider use the search type parameter SearchProviderType.localities:

swift
        let localitiesProvider = ProviderConfig(searchType: .localities,
                                                key: woosmapPrivateKey)

    

Available Provider parameters

  • types: the types of suggestion to return. Multiple types can be passed.
  • components: to filter over countries.
  • language: in which language the results should be returned. Searches are also biased to the selected language.
  • data: choose between DataFormat.standard or DataFormat.extended.
  • extended: allows a refined search over locality names that bears the same postal code.

Example Woosmap Localities Provider

swift
        let localitiesProvider = ProviderConfig(searchType: .localities,
                                        key: woosmapPrivateKey,
                                        minInputLength: 1,
                                        param: ConfigParam(
                                            components: Components(country: ["FR"]),
                                            types: ["locality", "country", "postal_code"]))

    

Woosmap Store Provider

To create a configuration for Woosmap Store provider use the search type parameter SearchProviderType.store:

swift
        let storeProvider = ProviderConfig(searchType: .store,
                                          key: woosmapPrivateKey)

    

Available Provider parameters

  • query: a search query combining one or more search clauses.

Example Woosmap Store Provider

swift
        let storeProvider = ProviderConfig(searchType: .store,
                                   key: woosmapPrivateKey,
                                   ignoreFallbackBreakpoint: true,
                                   param: ConfigParam(query:"type:bose_store"))

    

Google Places Provider

To create a configuration for Google Places provider use the search type parameter SearchProviderType.places:

swift
        let placesProvider = ProviderConfig(searchType: .places,
                                           key: googleApiKey)

    

Available Provider parameters

  • types: the types of suggestion to return. Multiple types can be passed.
  • components: to filter over countries.
  • language: in which language the results should be returned. Searches are also biased to the selected language.

Example Google Places Provider

swift
            let placesProvider = ProviderConfig(searchType: .places,
                                        key: googleApiKey,
                                        fallbackBreakpoint: 0.7,
                                        minInputLength: 1,
                                        param: ConfigParam(
                                            components: Components(country: ["FR"]), 
                                                                  language: "it"))

    
Was this helpful?