HistoryRecord

public struct HistoryRecord : IndexableRecord, SearchResult, Codable, Hashable

Resolved search result intended to represent user search history

  • “history icon” by default

    Declaration

    Swift

    public var iconName: String?
  • Type of stored history record

    See more

    Declaration

    Swift

    public enum HistoryType : Int, Codable
  • id

    Unique identifier

    Declaration

    Swift

    public private(set) var id: String { get }
  • Declaration

    Swift

    public private(set) var mapboxId: String? { get }
  • Record’s name

    Declaration

    Swift

    public private(set) var name: String { get }
  • Index in response from server.

    Declaration

    Swift

    public let serverIndex: Int?
  • A point accuracy metric for the returned address.

    Declaration

    Swift

    public let accuracy: SearchResultAccuracy?
  • The feature name, as matched by the search algorithm.

    Warning

    The field is exposed for compatibility only, will be removed soon.

    Declaration

    Swift

    public private(set) var matchingName: String? { get }
  • Address formatted with medium style

    Declaration

    Swift

    public var descriptionText: String? { get }
  • Coordinate associated with the record

    Declaration

    Swift

    public internal(set) var coordinate: CLLocationCoordinate2D { get set }
  • The time when the record was created.

    Declaration

    Swift

    public private(set) var timestamp: Date { get }
  • Type of object used to make a history record, e.g. result or query

    Declaration

    Swift

    public private(set) var historyType: HistoryType { get }
  • Original result type of object, e.g. address or POI

    Declaration

    Swift

    public private(set) var type: SearchResultType { get }
  • FavoriteRecord Always has estimatedTime as nil.

    Declaration

    Swift

    public var estimatedTime: Measurement<UnitDuration>?
  • Associated metadata at creating time if available.

    Declaration

    Swift

    public var metadata: SearchResultMetadata?
  • Address components of specific record

    Declaration

    Swift

    public var address: Address?
  • Additional indexable tokens for search engine

    SearchEngine would track that tokens to match results

    Declaration

    Swift

    public var additionalTokens: Set<String>?
  • Categories associated with original result

    Declaration

    Swift

    public var categories: [String]?
  • Original search request.

    Declaration

    Swift

    public let searchRequest: SearchRequestOptions
  • Coordinates of building entries

    Declaration

    Swift

    public var routablePoints: [RoutablePoint]?
  • History record constructor

    Declaration

    Swift

    public init(
        id: String = UUID().uuidString,
        mapboxId: String?,
        name: String,
        matchingName: String?,
        serverIndex: Int?,
        accuracy: SearchResultAccuracy?,
        coordinate: CLLocationCoordinate2D,
        timestamp: Date = Date(),
        historyType: HistoryRecord.HistoryType,
        type: SearchResultType,
        address: Address?,
        metadata: SearchResultMetadata? = nil,
        categories: [String]? = nil,
        searchRequest: SearchRequestOptions,
        routablePoints: [RoutablePoint]? = nil
    )

    Parameters

    id

    UUID used by default

    name

    History name

    coordinate

    History coordinate

    timestamp

    History timestamp

    historyType

    History type

    type

    History type

    address

    History address

    metadata

    Associated metadata

    categories

    Categories of original object

    routablePoints

    Coordinates of building entries

  • Construct HistoryRecord based on concrete SearchResult

    Declaration

    Swift

    public init(
        historyType: HistoryRecord.HistoryType = .result,
        searchResult: SearchResult,
        timestamp: Date = Date()
    )

    Parameters

    historyType

    Type of history result

    searchResult

    Prototype result

    timestamp

    creating timestamp. Calling time by default