Search Engine
Performs
forward geocoding (looking up a place by name to retrieve its geographic coordinates)
category search(search for places by category name)
reverse geocoding(search for places by geographic coordinate)
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:
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;
Get more details for suggestion (select). Depending on suggestion type, different logic might be applied:
For SearchSuggestionType.SearchResultSuggestion additional network request will be executed and result will be passed to SearchSelectionCallback.onResult;
For SearchSuggestionType.Category additional network request will be executed and list of results will be passed to SearchSelectionCallback.onResults;
For SearchSuggestionType.Brand additional network request will be executed and list of results will be passed to SearchSelectionCallback.onResults;
For SearchSuggestionType.Query additional network request will be executed and another list of suggestions will be passed to SearchSelectionCallback.onSuggestions. To get more information for provided suggestions you should use the same step (select);
For SearchSuggestionType.IndexableRecordItem extra information will be retrieved locally and result will be passed to SearchSelectionCallback.onResult.
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
Functions
Registers dataProvider in this SearchEngine.
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.
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.
Performs reverse geocoding.
Performs a search request for places based on a category.
The first step of forward geocoding. Returns a list of SearchSuggestion without coordinates.
The second step of forward geocoding. Call this function to get a SearchResult (with coordinates) from a SearchSuggestion.
Function to select multiple suggestions at once. Unlike select, resolving always ends up returning list of SearchResult and can't return new suggestions.
Unregisters previously registered IndexableDataProvider.
Properties
AnalyticsService instance associated with this SearchEngine.