create

fun create(context: Context, apiKey: String, ndsStore: NdsStore, customApiUrl: URL? = null): Search

Creates an instance of HybridSearch. For each API, it runs the OnlineSearch and OfflineSearch implementations in parallel, returns Result.success from the OnlineSearch implementation if succeeds or Result from the OfflineSearch implementation if OnlineSearch implementation fails (Result.failure, exception, or timeout occurs).

IMPORTANT NOTE The geopolitical view used here is same as that used in ndsStore.

Here is an example of creating an instance with a geopolitical view:

// set geopolitical view
val geopoliticalView = "USA"
val ndsStoreConfiguration = NdsStoreConfiguration(
ndsStorePath = File("/path/to/store"),
keystorePath = File("/path/to/keystore"),
storeAccessPermit = NdsStoreAccessPermit.KeystorePassword("password"),
geopoliticalView = geopoliticalView
)
val ndsStoreResult = NdsStore.create(context, ndsStoreConfiguration)
val hybridSearch = HybridSearch.create(context, apiKey, ndsStoreResult.value())

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

Parameters

context

Information about an application environment.

apiKey

API key for online search

ndsStore

Offline map handle.

customApiUrl

Custom base URL to be used to execute search API calls.


fun create(context: Context, apiKey: String, ndsStore: NdsStore, customPoiDataProviders: List<CustomPoiProvider>? = emptyList(), customApiUrl: URL? = null): Search

Creates an instance of HybridSearch with a custom data provider. For each API, it runs the OnlineSearch and OfflineSearch implementations in parallel. Returns Result.success from the OnlineSearch implementation if it succeeds or Result from the OfflineSearch implementation if the OnlineSearch implementation fails (Result.failure, exception, or timeout occurs).

IMPORTANT NOTE The geopolitical view used here is same as that used in ndsStore.

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

Parameters

context

Information about the application environment.

apiKey

API key for online search

ndsStore

Offline map handle.

customPoiDataProviders

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

customApiUrl

Custom base URL to be used to execute search API calls.

Example of creating an instance of HybridSearch with a custom data provider:

val geopoliticalView = "USA"
val ndsStoreConfiguration = NdsStoreConfiguration(
ndsStorePath = File("/path/to/store"),
keystorePath = File("/path/to/keystore"),
storeAccessPermit = NdsStoreAccessPermit.KeystorePassword("password"),
ndsStoreUpdateConfig = NdsStoreUpdateConfig(
updateStoragePath = File("/path/to/update/storage"),
persistentStoragePath = File("/path/to/persistent/storage")
),
geopoliticalView = geopoliticalView
)
val ndsStoreResult = NdsStore.create(context, ndsStoreConfiguration)
customPoiDataProvider = CustomPoiProvider("provider name")
customPoiDataProvider.setCustomPois(customPois)

val hybridSearch = HybridSearch.create(
context,
"YOUR_API_KEY",
ndsStoreResult.value(),
listOf(customPoiDataProvider)
)