@@ -38,7 +38,7 @@ public struct SearchOptions {
38
38
/// The bounding box cannot cross the 180th meridian.
39
39
public var boundingBox : BoundingBox ?
40
40
41
- /// In case ``SearchOptions/boundingBox`` was applied, places search will look though all available tiles,
41
+ /// In case ``SearchOptions/boundingBox`` was applied, places search will look through all available tiles,
42
42
/// ignoring the bounding box. Other search types (Address, POI, Category) will no be affected by this setting.
43
43
/// In case ``SearchOptions/boundingBox`` was not applied - this param will not be used.
44
44
public var offlineSearchPlacesOutsideBbox : Bool
@@ -85,6 +85,10 @@ public struct SearchOptions {
85
85
*/
86
86
public var locale : Locale ?
87
87
88
+ /// Configures additional metadata attributes besides the basic ones. This property is used only in category search.
89
+ /// Supported in ``ApiType/searchBox`` only.
90
+ public var attributeSets : [ AttributeSet ] ?
91
+
88
92
/// Search request options constructor
89
93
/// - Parameter countries: Limit results to one or more countries. Permitted values are ISO 3166 alpha 2 country
90
94
/// codes (e.g. US, DE, GB)
@@ -94,6 +98,7 @@ public struct SearchOptions {
94
98
/// - Parameter fuzzyMatch: Use non-strict (`true`) or strict (`false`) matching
95
99
/// - Parameter proximity: Coordinate to search around
96
100
/// - Parameter boundingBox: Limit search result to a region
101
+ /// - Parameter offlineSearchPlacesOutsideBbox: Configures if places can be looked through all available files ignoring the bounding box
97
102
/// - Parameter origin: Search origin point. This point is used for calculation of SearchResult ETA and distance
98
103
/// fields
99
104
/// - Parameter navigationOptions: Navigation options used for proper calculation of ETA and results ranking
@@ -102,6 +107,8 @@ public struct SearchOptions {
102
107
/// - Parameter ignoreIndexableRecords: Do not search external records in `IndexableDataProvider`s
103
108
/// - Parameter indexableRecordsDistanceThreshold: Radius of circle around `proximity` to filter indexable records
104
109
/// - Parameter unsafeParameters: Non-verified query parameters to the server API
110
+ /// - Parameter attributeSets: Configures additional metadata attributes besides the basic ones. If `attributeSets`
111
+ /// is `nil` or empty, ``AttributeSet/basic`` will be requested.
105
112
public init (
106
113
countries: [ String ] ? = nil ,
107
114
languages: [ String ] ? = nil ,
@@ -116,7 +123,8 @@ public struct SearchOptions {
116
123
filterTypes: [ SearchQueryType ] ? = nil ,
117
124
ignoreIndexableRecords: Bool = false ,
118
125
indexableRecordsDistanceThreshold: CLLocationDistance ? = nil ,
119
- unsafeParameters: [ String : String ] ? = nil
126
+ unsafeParameters: [ String : String ] ? = nil ,
127
+ attributeSets: [ AttributeSet ] ? = nil
120
128
) {
121
129
self . countries = countries
122
130
self . languages = languages ?? Locale . defaultLanguages ( )
@@ -132,6 +140,7 @@ public struct SearchOptions {
132
140
self . ignoreIndexableRecords = ignoreIndexableRecords
133
141
self . indexableRecordsDistanceThreshold = indexableRecordsDistanceThreshold
134
142
self . unsafeParameters = unsafeParameters
143
+ self . attributeSets = attributeSets
135
144
}
136
145
137
146
/// Search request options with custom proximity.
@@ -199,9 +208,11 @@ public struct SearchOptions {
199
208
latitude: $0. value. latitude,
200
209
longitude: $0. value. longitude
201
210
) }
202
- let filterTypes : [ SearchQueryType ] ? = options. types?
203
- . compactMap { CoreQueryType ( rawValue: $0. intValue) }
204
- . compactMap { SearchQueryType . fromCoreValue ( $0) }
211
+
212
+ let filterTypes : [ SearchQueryType ] ? = options. types? . compactMap {
213
+ CoreQueryType ( rawValue: $0. intValue)
214
+ . flatMap { SearchQueryType . fromCoreValue ( $0) }
215
+ }
205
216
206
217
var routeOptions : RouteOptions ?
207
218
let coordinates = options. route? . map ( \. value)
@@ -218,6 +229,11 @@ public struct SearchOptions {
218
229
etaType: etaType
219
230
) }
220
231
232
+ let attributeSets : [ AttributeSet ] ? = options. attributeSets? . compactMap {
233
+ CoreAttributeSet ( rawValue: $0. intValue)
234
+ . flatMap { AttributeSet . fromCoreValue ( $0) }
235
+ }
236
+
221
237
self . init (
222
238
countries: options. countries,
223
239
languages: options. language,
@@ -231,7 +247,8 @@ public struct SearchOptions {
231
247
filterTypes: filterTypes,
232
248
ignoreIndexableRecords: options. ignoreUR,
233
249
indexableRecordsDistanceThreshold: options. urDistanceThreshold? . doubleValue,
234
- unsafeParameters: options. addonAPI
250
+ unsafeParameters: options. addonAPI,
251
+ attributeSets: attributeSets
235
252
)
236
253
}
237
254
@@ -267,8 +284,8 @@ public struct SearchOptions {
267
284
addonAPI: unsafeParameters,
268
285
offlineSearchPlacesOutsideBbox: offlineSearchPlacesOutsideBbox,
269
286
ensureResultsPerCategory: nil ,
270
- // TODO: Support multiple categories search and ability to ensure results per category.
271
- attributeSets: nil
287
+ // TODO: NAVIOS-2054 Support multiple categories search and ability to ensure results per category.
288
+ attributeSets: attributeSets ? . map { NSNumber ( value : $0 . coreValue . rawValue ) }
272
289
)
273
290
}
274
291
@@ -412,7 +429,8 @@ public struct SearchOptions {
412
429
ignoreIndexableRecords: ignoreIndexableRecords,
413
430
indexableRecordsDistanceThreshold: indexableRecordsDistanceThreshold ??
414
431
with. indexableRecordsDistanceThreshold,
415
- unsafeParameters: unsafeParameters ?? with. unsafeParameters
432
+ unsafeParameters: unsafeParameters ?? with. unsafeParameters,
433
+ attributeSets: attributeSets ?? with. attributeSets
416
434
)
417
435
}
418
436
}
0 commit comments