SearchInterface Protocol Reference
- Last UpdatedJul 23, 2025
- 3 minute read
public protocol SearchInterface : AnyObject
Provides the protocol for the online and offline search engines.
-
Performs an asynchronous text query search for
Place
instances within a givenTextQuery.Area
. The returned places are sorted by relevance.Declaration
Swift
@discardableResult func searchByText(_ query: TextQuery, options: SearchOptions, completion: @escaping SearchCompletionHandler) -> TaskHandle
Parameters
query
Desired free-form text query to search.
options
Search options.
completion
Callback which receives the result on the main thread.
Return Value
Handle that will be used to manipulate the execution of the task.
-
Performs an asynchronous address query search for
Place
instances. This is the same type of search as forward geocoding, except that more data is returned than just the geographic coordinates of a given address. Note that an address can belong to more than onePlace
result, although all found places will share the same geographic coordinates. The returned places are sorted by relevance.Declaration
Swift
@discardableResult func searchByAddress(_ query: AddressQuery, options: SearchOptions, completion: @escaping SearchCompletionHandler) -> TaskHandle
Parameters
query
Desired free-form address query text to search.
options
Search options.
completion
Callback which receives the result on the main thread.
Return Value
Handle that will be used to manipulate the execution of the task.
-
Performs an asynchronous category search for
Place
instances. A list containing at least onePlaceCategory
must be provided as part of thesearchByCategory(...).query
.Declaration
Swift
@discardableResult func searchByCategory(_ query: CategoryQuery, options: SearchOptions, completion: @escaping SearchCompletionHandler) -> TaskHandle
Parameters
query
Query with list of desired categories.
options
Search options.
completion
Callback which receives the result on the main thread.
Return Value
Handle that will be used to manipulate the execution of the task.
-
Performs an asynchronous search for
Place
instances based on the given geographic coordinates. This is the same search type as reverse geocoding, except that more data is returned than just theAddress
related to the given coordinates. Note that more than onePlace
can be related to the given coordinates. The returned places are sorted by relevance.Declaration
Swift
@discardableResult func searchByCoordinates(_ coordinates: GeoCoordinates, options: SearchOptions, completion: @escaping SearchCompletionHandler) -> TaskHandle
Parameters
coordinates
The coordinates where to search.
options
Search options.
completion
Callback which receives result on the main thread.
Return Value
Handle that will be used to manipulate execution of the task.
-
Performs an asynchronous search for a
Place
based on its ID andLanguageCode
.Declaration
Swift
@discardableResult func searchByPlaceId(_ query: PlaceIdQuery, languageCode: LanguageCode?, completion: @escaping PlaceIdSearchCompletionHandler) -> TaskHandle
Parameters
query
The id of place to search.
languageCode
The preferred language for the search results. When unset or unsupported language is chosen, results will be returned in their local language.
completion
Callback which receives the result on the main thread.
Return Value
Handle that will be used to manipulate the execution of the task.
-
Performs an asynchronous search for a
Place
based on the content found inPickedPlace
. IfPickedPlace
data is obtained from the offline map, it may happen that the newer version that is used by the online service represented bySearchEngine
no longer contains the related POI. In that case,SearchError.noResultsFound
error is reported. When that happens, you may try to obtain the POI from the offline map by callingOfflineSearchEngine.searchByPickedPlace
. Note that not all editions include theOfflineSearchEngine
.Declaration
Swift
@discardableResult func searchByPickedPlace(_ pickedPlace: PickedPlace, languageCode: LanguageCode?, completion: @escaping PlaceIdSearchCompletionHandler) -> TaskHandle
Parameters
pickedPlace
The content picked from map.
languageCode
The preferred language for the search result. When unset or unsupported language is chosen, result will be returned in the local language.
completion
Callback which receives the result on the main thread.
Return Value
Handle that will be used to manipulate the execution of the task.
-
Performs an asynchronous request to suggest places for text queries and returns suggestions sorted by relevance.
Note that while
OfflineSearchEngine
includes as many details as are available,SearchEngine
includes only the information that is relevant for autosuggest use cases. Complete details can be obtained by searching withPlaceIdQuery
.Declaration
Swift
@discardableResult func suggestByText(_ query: TextQuery, options: SearchOptions, completion: @escaping SuggestCompletionHandler) -> TaskHandle
Parameters
query
Desired text query to search.
options
Search options.
completion
Callback which receives the result on the main thread.
Return Value
Handle that will be used to manipulate the execution of the task.