SearchEngine

interface SearchEngine

Performs

SearchEngine API requires an online connection to execute the requests.

Instantiating

Call SearchEngine.createSearchEngine to get instance of a SearchEngine.

Forward geocoding algorithm

Forward geocoding consists of 2 steps:

  1. Retrieve suggestions (search). For giving query we provide a list of suggestions, which contain only basic information (name of a place/category/query, its description, its type and etc.). Provided suggestions will be passed to SearchSuggestionsCallback.onSuggestions. Note, that such information as coordinates of place is not available at this step. To get this information, proceed to next step;

  2. Get more details for suggestion (select). Depending on suggestion type, different logic might be applied:

    If you want to get coordinates of search suggestion (or more details about suggestion), you should use select method. You will receive more detailed information.

Error handling

If invalid parameters are provided, RuntimeException is thrown immediately. Any other error will be propagated to SearchSuggestionsCallback.onError.

See also

Types

Link copied to clipboard
object Companion

Companion object.

Functions

Link copied to clipboard
open fun <R : IndexableRecord> registerDataProvider(dataProvider: IndexableDataProvider<R>, callback: CompletionCallback<Unit>): AsyncOperationTask
abstract fun <R : IndexableRecord> registerDataProvider(dataProvider: IndexableDataProvider<R>, executor: Executor, callback: CompletionCallback<Unit>): AsyncOperationTask

Registers dataProvider in this SearchEngine.

Link copied to clipboard
open fun retrieve(mapboxId: String, callback: SearchResultCallback): AsyncOperationTask

Function to retrieve the details for a given mapboxId that dispatches events using the main executor. The callback will be invoked with a SearchResult on successful execution.

abstract fun retrieve(mapboxId: String, executor: Executor, callback: SearchResultCallback): AsyncOperationTask

Function to retrieve the details for a given mapboxId. The callback will be invoked with a SearchResult on successful execution. This method is only supported for a SearchEngine with ApiType.SBS.

Link copied to clipboard
open fun search(options: ReverseGeoOptions, callback: SearchCallback): AsyncOperationTask
abstract fun search(options: ReverseGeoOptions, executor: Executor, callback: SearchCallback): AsyncOperationTask

Performs reverse geocoding.

open fun search(categoryName: String, options: CategorySearchOptions, callback: SearchCallback): AsyncOperationTask
abstract fun search(categoryName: String, options: CategorySearchOptions, executor: Executor, callback: SearchCallback): AsyncOperationTask

Performs a search request for places based on a category.

open fun search(query: String, options: SearchOptions, callback: SearchSuggestionsCallback): AsyncOperationTask
abstract fun search(query: String, options: SearchOptions, executor: Executor, callback: SearchSuggestionsCallback): AsyncOperationTask

The first step of forward geocoding. Returns a list of SearchSuggestion without coordinates.

Link copied to clipboard
open fun select(suggestion: SearchSuggestion, callback: SearchSelectionCallback): AsyncOperationTask
open fun select(suggestion: SearchSuggestion, options: SelectOptions, callback: SearchSelectionCallback): AsyncOperationTask
abstract fun select(suggestion: SearchSuggestion, options: SelectOptions, executor: Executor, callback: SearchSelectionCallback): AsyncOperationTask

The second step of forward geocoding. Call this function to get a SearchResult (with coordinates) from a SearchSuggestion.

open fun select(suggestions: List<SearchSuggestion>, callback: SearchMultipleSelectionCallback): AsyncOperationTask
abstract fun select(suggestions: List<SearchSuggestion>, executor: Executor, callback: SearchMultipleSelectionCallback): AsyncOperationTask

Function to select multiple suggestions at once. Unlike select, resolving always ends up returning list of SearchResult and can't return new suggestions.

Link copied to clipboard
open fun <R : IndexableRecord> unregisterDataProvider(dataProvider: IndexableDataProvider<R>, callback: CompletionCallback<Unit>): AsyncOperationTask
abstract fun <R : IndexableRecord> unregisterDataProvider(dataProvider: IndexableDataProvider<R>, executor: Executor, callback: CompletionCallback<Unit>): AsyncOperationTask

Unregisters previously registered IndexableDataProvider.

Properties

Link copied to clipboard

AnalyticsService instance associated with this SearchEngine.

Link copied to clipboard
abstract val apiType: ApiType

The type of the API used by the Search Engine.

Link copied to clipboard

Settings used for SearchEngine initialization.