SearchOptions

public struct SearchOptions

Specifies fuzzy search options.

  • Creates SearchOptions to perform a fuzzy search request.

    Declaration

    Swift

    public init(
        query: String = "",
        geoBias: CLLocationCoordinate2D? = nil,
        limit: Int = 10,
        searchAreas: Set<Geometry> = [],
        locale: Locale = Locale.current,
        categoryIDs: Set<POICategoryID> = [],
        openingHoursMode: OpeningHoursMode? = .nextSevenDays(from: Date()),
        countryCodes: Set<String> = [],
        brands: Set<Brand> = [],
        minPower: Measurement<UnitPower>? = nil,
        maxPower: Measurement<UnitPower>? = nil,
        fuelTypes: Set<FuelType> = [],
        resultTypes: Set<SearchResultType> = [],
        connectors: Set<ConnectorType> = [],
        sessionID: UUID? = nil
    )

    Parameters

    query

    The search query.

    geoBias

    The coordinates where results should be biased.

    limit

    The maximum number of search results that will be returned.

    searchAreas

    The geographic filter for search, all search results returned are confined in the specified geography.

    locale

    The language in which search results should be returned. If not specified, language is set to the default official language of the location of the result.

    categoryIDs

    Restricts the Points Of Interest in the response to those whose category ID is listed.

    openingHoursMode

    Scope of the opening hours to be provided. If the parameter is set to nil, no opening hours are returned in the response. By default, requests opening hours for the next seven (7) days. If a chosen mode contains an associated start date, it is ignored by the backend.

    countryCodes

    A set of ISO 3166-1 alpha3 country codes. (e.g., FRA, ESP, USA). This will limit the search to the specified countries.

    brands

    A set of brands used to restrict the result to POIs associated with those brands.

    minPower

    The minimal power that a charging station can provide.

    maxPower

    The maximal power that a charging station can provide.

    fuelTypes

    A set of fuel types that a gas station can provide.

    resultTypes

    A set of SearchResultType to filter results.

    connectors

    A set of connector types that a charging station supports. See https://developer.tomtom.com/search-api/search-api-documentation/supported-connector-types for more details.

    sessionID

    A search session is a user session during which a user performs multiple search requests to find a specific address or point of interest. This is needed for sending feedback to the online search.

  • Creates SearchOptions to perform fuzzy search request.

    Declaration

    Swift

    @available(*, deprecated, renamed: "init(query:geoBias:limit:searchAreas:locale:categoryIDs:openingHoursMode:countryCodes:brands:minPower:maxPower:fuelTypes:resultTypes:connectors:sessionID:﹚", message: "This API is deprecated and will be removed with the next major release.")
    public init(
        query: String = "",
        geoBias: CLLocationCoordinate2D? = nil,
        sortOrder: SortOrder = .byDetourTime,
        limit: Int = 10,
        searchAreas: Set<Geometry> = [],
        locale: Locale = Locale.current,
        categoryIDs: Set<POICategoryID> = [],
        openingHoursMode: OpeningHoursMode? = .nextSevenDays(from: Date()),
        countryCodes: Set<String> = [],
        brands: Set<Brand> = [],
        minPower: Measurement<UnitPower>? = nil,
        maxPower: Measurement<UnitPower>? = nil,
        fuelTypes: Set<FuelType> = [],
        resultTypes: Set<SearchResultType> = [],
        connectors: Set<ConnectorType> = [],
        sessionID: UUID? = nil
    )

    Parameters

    query

    The search query.

    geoBias

    The coordinates where results should be biased.

    sortOrder

    Determines order of the results. Defaults to byDetourTime.

    limit

    The maximum number of search results that will be returned.

    searchAreas

    The geographic filter for search, all search results returned are confined in the specified geography.

    locale

    The language in which search results should be returned. If not specified, language is set to the default official language of the location of the result.

    categoryIDs

    Restricts the Points Of Interest in the response to those whose category ID is listed.

    openingHoursMode

    Scope of the opening hours to be provided. If the parameter is set to nil, no opening hours are returned in the response. By default, requests opening hours for the next seven (7) days. If a chosen mode contains an associated start date, it is ignored by the backend.

    countryCodes

    A set of ISO 3166-1 alpha3 country codes. (e.g., FRA, ESP, USA). This will limit the search to the specified countries.

    brands

    A set of brands used to restrict the result to POIs associated with those brands.

    minPower

    The minimal power that a charging station can provide.

    maxPower

    The maximal power that a charging station can provide.

    fuelTypes

    A set of fuel types that a gas station can provide.

    resultTypes

    A set of SearchResultType to filter results.

    connectors

    A set of connector types that a charging station supports. See https://developer.tomtom.com/search-api/search-api-documentation/supported-connector-types for more details.

    sessionID

    A search session is a user session during which a user performs multiple search requests to find a specific address or point of interest. This is needed for sending feedback to the online search.

  • Creates a SearchOptions object to perform a search along a route.

    A common use case is to search along the remaining part of the current route. Example:

    let route: Route = currentRoute
    let progress: RouteProgress = currentProgress
    let remainingRoute = route.routePoints.filter { $0.routeOffset > progress.distanceAlongRoute }
    let remainingCoordinates = remainingRoute.map { $0.coordinate }
    let query = "ATM"
    let alongRouteSearchOptions = SearchOptions(
      query: query,
      route: remainingCoordinates,
      maxDetourDuration: Measurement.tt.seconds(600),
      limit: 10
    )
    

    Declaration

    Swift

    public init(
        query: String = "",
        route: [CLLocationCoordinate2D],
        maxDetourDuration: Measurement<UnitDuration> = Defaults.maxDetourTime,
        sortOrder: SortOrder = .byDetourTime,
        limit: Int = 10,
        locale: Locale = Locale.current,
        categoryIDs: Set<POICategoryID> = [],
        openingHoursMode: OpeningHoursMode? = .nextSevenDays(from: Date()),
        brands: Set<Brand> = [],
        minPower: Measurement<UnitPower>? = nil,
        maxPower: Measurement<UnitPower>? = nil,
        fuelTypes: Set<FuelType> = [],
        connectors: Set<ConnectorType> = [],
        sessionID: UUID? = nil
    )

    Parameters

    query

    The search query.

    route

    A list of coordinates forming a route, along which to search.

    maxDetourDuration

    The maximum time added to the estimated time of arrival at the destination because of the route change. Max supported detour time is defined in Defaults.maxDetourTime.

    sortOrder

    Determines order of the results. Defaults to byDetourTime.

    limit

    The maximum number of search results that will be returned.

    locale

    The language in which search results should be returned. If not specified, language is set to the default official language of the location of the result.

    categoryIDs

    Restricts the Points Of Interest in the response to those whose category ID is listed.

    openingHoursMode

    Scope of the opening hours to be provided. If the parameter is set to nil, no opening hours are returned in the response. By default, requests opening hours for the next seven (7) days. If a chosen mode contains an associated start date, it is ignored by the backend.

    brands

    A set of brands used to restrict the result to POIs associated with those brands.

    minPower

    The minimal power that a charging station can provide.

    maxPower

    The maximal power that a charging station can provide.

    fuelTypes

    A set of fuel types that a gas station can provide.

    connectors

    A set of connector types that a charging station supports. See https://developer.tomtom.com/search-api/search-api-documentation/supported-connector-types for more details.

    sessionID

    A search session is a user session during which a user performs multiple search requests to find a specific address or point of interest. This is needed for sending feedback to the online search.

  • Default values used in the SearchOptions.

    See more

    Declaration

    Swift

    public enum Defaults
  • The search query.

    Declaration

    Swift

    public var query: String
  • The position where results should be biased.

    Declaration

    Swift

    public var geoBias: CLLocationCoordinate2D?
  • The maximum number of search results that will be returned. Defaults to 10.

    Declaration

    Swift

    public var limit: Int
  • The geographic filter for search, all search results returned are confined in the specified geographies. CircleGeometry and RectangleGeomety support geoBias. CircleGeometry center is also used as geoBias. PolygonGeometry ignores geoBias.

    Important

    Only first geometry will be used. Full support will come in coming releases.

    Declaration

    Swift

    public var searchAreas: Set<Geometry>
  • A list of coordinates forming the route, along which the search is to be done. A route can be fetched from a RoutePlanner.

    Declaration

    Swift

    public let route: [CLLocationCoordinate2D]
  • The time added to the estimated time of arrival at the destination because of the change of route.

    Note

    The maximum value is defined in Defaults.maxDetourTime.

    Declaration

    Swift

    public let maxDetourDuration: Measurement<UnitDuration>?
  • Defines how the results will be sorted. Only searching along a route makes use of this option.

    Declaration

    Swift

    public let sortOrder: SortOrder
  • The language in which search results should be returned.

    Declaration

    Swift

    public var locale: Locale
  • Restricts the Points Of Interest in the response to those whose category ID is listed.

    Declaration

    Swift

    public var categoryIDs: Set<POICategoryID>
  • Scope of the opening hours to be provided. If the parameter is set to nil, no opening hours are returned in the response. By default, requests opening hours for the next seven (7) days.

    Note

    if a chosen mode contains an associated start date, it is ignored by the backend.

    Declaration

    Swift

    public var openingHoursMode: OpeningHoursMode?
  • A set of ISO 3166-1 alpha3 country codes. (e.g., FRA, ESP, USA). This will limit the search to the specified countries.

    Declaration

    Swift

    public var countryCodes: Set<String>
  • A set of brands used to restrict the result to POIs associated with those brands.

    Declaration

    Swift

    public var brands: Set<Brand>
  • The minimal power that a charging station can provide.

    Declaration

    Swift

    public var minPower: Measurement<UnitPower>?
  • The maximal power that a charging station can provide.

    Declaration

    Swift

    public var maxPower: Measurement<UnitPower>?
  • A set of fuel types that a gas station can provide.

    Declaration

    Swift

    public var fuelTypes: Set<FuelType>
  • A list of SearchResultType to filter results.

    Declaration

    Swift

    public var resultTypes: Set<SearchResultType>
  • A list of connector types that a charging station supports. See https://developer.tomtom.com/search-api/search-api-documentation/supported-connector-types for more details.

    Declaration

    Swift

    public var connectors: Set<ConnectorType>
  • A search session is a user session during which a user performs multiple search requests to find a specific address or point of interest. This is needed for sending feedback to the online search.

    Declaration

    Swift

    public var sessionID: UUID?