create
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: This is a Public Preview API. It may be changed or removed at any time.
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())
Parameters
Information about an application environment.
API key for online search
Offline map handle.
Custom base URL to be used to execute search API calls.
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: This is a Public Preview API. It may be changed or removed at any time.
IMPORTANT NOTE The geopolitical view used here is same as that used in ndsStore.
Parameters
Information about the application environment.
API key for online search
Offline map handle.
Custom data providers for injecting external data into the search engine.
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"),
ndsStoreUpdaterConfiguration = NdsStoreUpdaterConfiguration(
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)
)