Skip to content

Commit 083a522

Browse files
algolia-botmillotp
andcommitted
fix(specs): make the searchParams compatible with v4 [skip-bc] (generated)
algolia/api-clients-automation#4108 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Pierre Millot <[email protected]>
1 parent 0d11c4c commit 083a522

23 files changed

+326
-337
lines changed

Sources/Recommend/Models/BaseRecommendIndexSettings.swift

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -86,19 +86,7 @@ public struct BaseRecommendIndexSettings: Codable, JSONEncodable {
8686
/// Whether to support phrase matching and excluding words from search queries. Use the `advancedSyntaxFeatures`
8787
/// parameter to control which feature is supported.
8888
public var advancedSyntax: Bool?
89-
/// Words that should be considered optional when found in the query. By default, records must match all words in
90-
/// the search query to be included in the search results. Adding optional words can help to increase the number of
91-
/// search results by running an additional search query that doesn't include the optional words. For example, if
92-
/// the search query is \"action video\" and \"video\" is an optional word, the search engine runs two queries. One
93-
/// for \"action video\" and one for \"action\". Records that match all words are ranked higher. For a search query
94-
/// with 4 or more words **and** all its words are optional, the number of matched words required for a record to be
95-
/// included in the search results increases for every 1,000 records: - If `optionalWords` has less than 10 words,
96-
/// the required number of matched words increases by 1: results 1 to 1,000 require 1 matched word, results 1,001
97-
/// to 2000 need 2 matched words. - If `optionalWords` has 10 or more words, the number of required matched words
98-
/// increases by the number of optional words divided by 5 (rounded down). For example, with 18 optional words:
99-
/// results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 4 matched words. For more information,
100-
/// see [Optional words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words).
101-
public var optionalWords: [String]?
89+
public var optionalWords: RecommendOptionalWords?
10290
/// Searchable attributes for which you want to [turn off the Exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes).
10391
/// Attribute names are case-sensitive. This can be useful for attributes with long values, where the likelihood of
10492
/// an exact match is high, such as product descriptions. Turning off the Exact ranking criterion for these
@@ -138,9 +126,6 @@ public struct BaseRecommendIndexSettings: Codable, JSONEncodable {
138126
/// `parsedQuery`, or any property triggered by the `getRankingInfo` parameter. Don't exclude properties that you
139127
/// might need in your search UI.
140128
public var responseFields: [String]?
141-
/// Maximum number of facet values to return when [searching for facet
142-
/// values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values).
143-
public var maxFacetHits: Int?
144129
/// Maximum number of facet values to return for each facet.
145130
public var maxValuesPerFacet: Int?
146131
/// Order in which to retrieve facet values. - `count`. Facet values are retrieved by decreasing count. The
@@ -184,7 +169,7 @@ public struct BaseRecommendIndexSettings: Codable, JSONEncodable {
184169
queryType: RecommendQueryType? = nil,
185170
removeWordsIfNoResults: RecommendRemoveWordsIfNoResults? = nil,
186171
advancedSyntax: Bool? = nil,
187-
optionalWords: [String]? = nil,
172+
optionalWords: RecommendOptionalWords? = nil,
188173
disableExactOnAttributes: [String]? = nil,
189174
exactOnSingleWordQuery: RecommendExactOnSingleWordQuery? = nil,
190175
alternativesAsExact: [RecommendAlternativesAsExact]? = nil,
@@ -193,7 +178,6 @@ public struct BaseRecommendIndexSettings: Codable, JSONEncodable {
193178
replaceSynonymsInHighlight: Bool? = nil,
194179
minProximity: Int? = nil,
195180
responseFields: [String]? = nil,
196-
maxFacetHits: Int? = nil,
197181
maxValuesPerFacet: Int? = nil,
198182
sortFacetValuesBy: String? = nil,
199183
attributeCriteriaComputedByMinProximity: Bool? = nil,
@@ -233,7 +217,6 @@ public struct BaseRecommendIndexSettings: Codable, JSONEncodable {
233217
self.replaceSynonymsInHighlight = replaceSynonymsInHighlight
234218
self.minProximity = minProximity
235219
self.responseFields = responseFields
236-
self.maxFacetHits = maxFacetHits
237220
self.maxValuesPerFacet = maxValuesPerFacet
238221
self.sortFacetValuesBy = sortFacetValuesBy
239222
self.attributeCriteriaComputedByMinProximity = attributeCriteriaComputedByMinProximity
@@ -275,7 +258,6 @@ public struct BaseRecommendIndexSettings: Codable, JSONEncodable {
275258
case replaceSynonymsInHighlight
276259
case minProximity
277260
case responseFields
278-
case maxFacetHits
279261
case maxValuesPerFacet
280262
case sortFacetValuesBy
281263
case attributeCriteriaComputedByMinProximity
@@ -323,7 +305,6 @@ public struct BaseRecommendIndexSettings: Codable, JSONEncodable {
323305
try container.encodeIfPresent(self.replaceSynonymsInHighlight, forKey: .replaceSynonymsInHighlight)
324306
try container.encodeIfPresent(self.minProximity, forKey: .minProximity)
325307
try container.encodeIfPresent(self.responseFields, forKey: .responseFields)
326-
try container.encodeIfPresent(self.maxFacetHits, forKey: .maxFacetHits)
327308
try container.encodeIfPresent(self.maxValuesPerFacet, forKey: .maxValuesPerFacet)
328309
try container.encodeIfPresent(self.sortFacetValuesBy, forKey: .sortFacetValuesBy)
329310
try container.encodeIfPresent(
@@ -370,7 +351,6 @@ extension BaseRecommendIndexSettings: Equatable {
370351
lhs.replaceSynonymsInHighlight == rhs.replaceSynonymsInHighlight &&
371352
lhs.minProximity == rhs.minProximity &&
372353
lhs.responseFields == rhs.responseFields &&
373-
lhs.maxFacetHits == rhs.maxFacetHits &&
374354
lhs.maxValuesPerFacet == rhs.maxValuesPerFacet &&
375355
lhs.sortFacetValuesBy == rhs.sortFacetValuesBy &&
376356
lhs.attributeCriteriaComputedByMinProximity == rhs.attributeCriteriaComputedByMinProximity &&
@@ -414,7 +394,6 @@ extension BaseRecommendIndexSettings: Hashable {
414394
hasher.combine(self.replaceSynonymsInHighlight?.hashValue)
415395
hasher.combine(self.minProximity?.hashValue)
416396
hasher.combine(self.responseFields?.hashValue)
417-
hasher.combine(self.maxFacetHits?.hashValue)
418397
hasher.combine(self.maxValuesPerFacet?.hashValue)
419398
hasher.combine(self.sortFacetValuesBy?.hashValue)
420399
hasher.combine(self.attributeCriteriaComputedByMinProximity?.hashValue)

Sources/Recommend/Models/BaseRecommendSearchParams.swift

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,7 @@ public struct BaseRecommendSearchParams: Codable, JSONEncodable {
5555
public var aroundPrecision: RecommendAroundPrecision?
5656
/// Minimum radius (in meters) for a search around a location when `aroundRadius` isn't set.
5757
public var minimumAroundRadius: Int?
58-
/// Coordinates for a rectangular area in which to search. Each bounding box is defined by the two opposite points
59-
/// of its diagonal, and expressed as latitude and longitude pair: `[p1 lat, p1 long, p2 lat, p2 long]`. Provide
60-
/// multiple bounding boxes as nested arrays. For more information, see [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas).
61-
public var insideBoundingBox: [[Double]]?
58+
public var insideBoundingBox: RecommendInsideBoundingBox?
6259
/// Coordinates of a polygon in which to search. Polygons are defined by 3 to 10,000 points. Each point is
6360
/// represented by its latitude and longitude. Provide multiple polygons as nested arrays. For more information, see
6461
/// [filtering inside polygons](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas).
@@ -112,7 +109,7 @@ public struct BaseRecommendSearchParams: Codable, JSONEncodable {
112109
aroundRadius: RecommendAroundRadius? = nil,
113110
aroundPrecision: RecommendAroundPrecision? = nil,
114111
minimumAroundRadius: Int? = nil,
115-
insideBoundingBox: [[Double]]? = nil,
112+
insideBoundingBox: RecommendInsideBoundingBox? = nil,
116113
insidePolygon: [[Double]]? = nil,
117114
naturalLanguages: [RecommendSupportedLanguage]? = nil,
118115
ruleContexts: [String]? = nil,

Sources/Recommend/Models/FallbackParams.swift

Lines changed: 13 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,7 @@ public struct FallbackParams: Codable, JSONEncodable {
5555
public var aroundPrecision: RecommendAroundPrecision?
5656
/// Minimum radius (in meters) for a search around a location when `aroundRadius` isn't set.
5757
public var minimumAroundRadius: Int?
58-
/// Coordinates for a rectangular area in which to search. Each bounding box is defined by the two opposite points
59-
/// of its diagonal, and expressed as latitude and longitude pair: `[p1 lat, p1 long, p2 lat, p2 long]`. Provide
60-
/// multiple bounding boxes as nested arrays. For more information, see [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas).
61-
public var insideBoundingBox: [[Double]]?
58+
public var insideBoundingBox: RecommendInsideBoundingBox?
6259
/// Coordinates of a polygon in which to search. Polygons are defined by 3 to 10,000 points. Each point is
6360
/// represented by its latitude and longitude. Provide multiple polygons as nested arrays. For more information, see
6461
/// [filtering inside polygons](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas).
@@ -189,6 +186,9 @@ public struct FallbackParams: Codable, JSONEncodable {
189186
/// to use the same attribute also for faceting, use the `afterDistinct` modifier of the `attributesForFaceting`
190187
/// setting. This applies faceting _after_ deduplication, which will result in accurate facet counts.
191188
public var attributeForDistinct: String?
189+
/// Maximum number of facet values to return when [searching for facet
190+
/// values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values).
191+
public var maxFacetHits: Int?
192192
/// Attributes to include in the API response. To reduce the size of your response, you can retrieve only some of
193193
/// the attributes. Attribute names are case-sensitive. - `*` retrieves all attributes, except attributes included
194194
/// in the `customRanking` and `unretrievableAttributes` settings. - To retrieve all attributes except a specific
@@ -268,19 +268,7 @@ public struct FallbackParams: Codable, JSONEncodable {
268268
/// Whether to support phrase matching and excluding words from search queries. Use the `advancedSyntaxFeatures`
269269
/// parameter to control which feature is supported.
270270
public var advancedSyntax: Bool?
271-
/// Words that should be considered optional when found in the query. By default, records must match all words in
272-
/// the search query to be included in the search results. Adding optional words can help to increase the number of
273-
/// search results by running an additional search query that doesn't include the optional words. For example, if
274-
/// the search query is \"action video\" and \"video\" is an optional word, the search engine runs two queries. One
275-
/// for \"action video\" and one for \"action\". Records that match all words are ranked higher. For a search query
276-
/// with 4 or more words **and** all its words are optional, the number of matched words required for a record to be
277-
/// included in the search results increases for every 1,000 records: - If `optionalWords` has less than 10 words,
278-
/// the required number of matched words increases by 1: results 1 to 1,000 require 1 matched word, results 1,001
279-
/// to 2000 need 2 matched words. - If `optionalWords` has 10 or more words, the number of required matched words
280-
/// increases by the number of optional words divided by 5 (rounded down). For example, with 18 optional words:
281-
/// results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 4 matched words. For more information,
282-
/// see [Optional words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words).
283-
public var optionalWords: [String]?
271+
public var optionalWords: RecommendOptionalWords?
284272
/// Searchable attributes for which you want to [turn off the Exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes).
285273
/// Attribute names are case-sensitive. This can be useful for attributes with long values, where the likelihood of
286274
/// an exact match is high, such as product descriptions. Turning off the Exact ranking criterion for these
@@ -320,9 +308,6 @@ public struct FallbackParams: Codable, JSONEncodable {
320308
/// `parsedQuery`, or any property triggered by the `getRankingInfo` parameter. Don't exclude properties that you
321309
/// might need in your search UI.
322310
public var responseFields: [String]?
323-
/// Maximum number of facet values to return when [searching for facet
324-
/// values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values).
325-
public var maxFacetHits: Int?
326311
/// Maximum number of facet values to return for each facet.
327312
public var maxValuesPerFacet: Int?
328313
/// Order in which to retrieve facet values. - `count`. Facet values are retrieved by decreasing count. The
@@ -358,7 +343,7 @@ public struct FallbackParams: Codable, JSONEncodable {
358343
aroundRadius: RecommendAroundRadius? = nil,
359344
aroundPrecision: RecommendAroundPrecision? = nil,
360345
minimumAroundRadius: Int? = nil,
361-
insideBoundingBox: [[Double]]? = nil,
346+
insideBoundingBox: RecommendInsideBoundingBox? = nil,
362347
insidePolygon: [[Double]]? = nil,
363348
naturalLanguages: [RecommendSupportedLanguage]? = nil,
364349
ruleContexts: [String]? = nil,
@@ -389,6 +374,7 @@ public struct FallbackParams: Codable, JSONEncodable {
389374
userData: AnyCodable? = nil,
390375
customNormalization: [String: [String: String]]? = nil,
391376
attributeForDistinct: String? = nil,
377+
maxFacetHits: Int? = nil,
392378
attributesToRetrieve: [String]? = nil,
393379
ranking: [String]? = nil,
394380
relevancyStrictness: Int? = nil,
@@ -412,7 +398,7 @@ public struct FallbackParams: Codable, JSONEncodable {
412398
queryType: RecommendQueryType? = nil,
413399
removeWordsIfNoResults: RecommendRemoveWordsIfNoResults? = nil,
414400
advancedSyntax: Bool? = nil,
415-
optionalWords: [String]? = nil,
401+
optionalWords: RecommendOptionalWords? = nil,
416402
disableExactOnAttributes: [String]? = nil,
417403
exactOnSingleWordQuery: RecommendExactOnSingleWordQuery? = nil,
418404
alternativesAsExact: [RecommendAlternativesAsExact]? = nil,
@@ -421,7 +407,6 @@ public struct FallbackParams: Codable, JSONEncodable {
421407
replaceSynonymsInHighlight: Bool? = nil,
422408
minProximity: Int? = nil,
423409
responseFields: [String]? = nil,
424-
maxFacetHits: Int? = nil,
425410
maxValuesPerFacet: Int? = nil,
426411
sortFacetValuesBy: String? = nil,
427412
attributeCriteriaComputedByMinProximity: Bool? = nil,
@@ -475,6 +460,7 @@ public struct FallbackParams: Codable, JSONEncodable {
475460
self.userData = userData
476461
self.customNormalization = customNormalization
477462
self.attributeForDistinct = attributeForDistinct
463+
self.maxFacetHits = maxFacetHits
478464
self.attributesToRetrieve = attributesToRetrieve
479465
self.ranking = ranking
480466
self.relevancyStrictness = relevancyStrictness
@@ -507,7 +493,6 @@ public struct FallbackParams: Codable, JSONEncodable {
507493
self.replaceSynonymsInHighlight = replaceSynonymsInHighlight
508494
self.minProximity = minProximity
509495
self.responseFields = responseFields
510-
self.maxFacetHits = maxFacetHits
511496
self.maxValuesPerFacet = maxValuesPerFacet
512497
self.sortFacetValuesBy = sortFacetValuesBy
513498
self.attributeCriteriaComputedByMinProximity = attributeCriteriaComputedByMinProximity
@@ -563,6 +548,7 @@ public struct FallbackParams: Codable, JSONEncodable {
563548
case userData
564549
case customNormalization
565550
case attributeForDistinct
551+
case maxFacetHits
566552
case attributesToRetrieve
567553
case ranking
568554
case relevancyStrictness
@@ -595,7 +581,6 @@ public struct FallbackParams: Codable, JSONEncodable {
595581
case replaceSynonymsInHighlight
596582
case minProximity
597583
case responseFields
598-
case maxFacetHits
599584
case maxValuesPerFacet
600585
case sortFacetValuesBy
601586
case attributeCriteriaComputedByMinProximity
@@ -654,6 +639,7 @@ public struct FallbackParams: Codable, JSONEncodable {
654639
try container.encodeIfPresent(self.userData, forKey: .userData)
655640
try container.encodeIfPresent(self.customNormalization, forKey: .customNormalization)
656641
try container.encodeIfPresent(self.attributeForDistinct, forKey: .attributeForDistinct)
642+
try container.encodeIfPresent(self.maxFacetHits, forKey: .maxFacetHits)
657643
try container.encodeIfPresent(self.attributesToRetrieve, forKey: .attributesToRetrieve)
658644
try container.encodeIfPresent(self.ranking, forKey: .ranking)
659645
try container.encodeIfPresent(self.relevancyStrictness, forKey: .relevancyStrictness)
@@ -689,7 +675,6 @@ public struct FallbackParams: Codable, JSONEncodable {
689675
try container.encodeIfPresent(self.replaceSynonymsInHighlight, forKey: .replaceSynonymsInHighlight)
690676
try container.encodeIfPresent(self.minProximity, forKey: .minProximity)
691677
try container.encodeIfPresent(self.responseFields, forKey: .responseFields)
692-
try container.encodeIfPresent(self.maxFacetHits, forKey: .maxFacetHits)
693678
try container.encodeIfPresent(self.maxValuesPerFacet, forKey: .maxValuesPerFacet)
694679
try container.encodeIfPresent(self.sortFacetValuesBy, forKey: .sortFacetValuesBy)
695680
try container.encodeIfPresent(
@@ -750,6 +735,7 @@ extension FallbackParams: Equatable {
750735
lhs.userData == rhs.userData &&
751736
lhs.customNormalization == rhs.customNormalization &&
752737
lhs.attributeForDistinct == rhs.attributeForDistinct &&
738+
lhs.maxFacetHits == rhs.maxFacetHits &&
753739
lhs.attributesToRetrieve == rhs.attributesToRetrieve &&
754740
lhs.ranking == rhs.ranking &&
755741
lhs.relevancyStrictness == rhs.relevancyStrictness &&
@@ -782,7 +768,6 @@ extension FallbackParams: Equatable {
782768
lhs.replaceSynonymsInHighlight == rhs.replaceSynonymsInHighlight &&
783769
lhs.minProximity == rhs.minProximity &&
784770
lhs.responseFields == rhs.responseFields &&
785-
lhs.maxFacetHits == rhs.maxFacetHits &&
786771
lhs.maxValuesPerFacet == rhs.maxValuesPerFacet &&
787772
lhs.sortFacetValuesBy == rhs.sortFacetValuesBy &&
788773
lhs.attributeCriteriaComputedByMinProximity == rhs.attributeCriteriaComputedByMinProximity &&
@@ -840,6 +825,7 @@ extension FallbackParams: Hashable {
840825
hasher.combine(self.userData?.hashValue)
841826
hasher.combine(self.customNormalization?.hashValue)
842827
hasher.combine(self.attributeForDistinct?.hashValue)
828+
hasher.combine(self.maxFacetHits?.hashValue)
843829
hasher.combine(self.attributesToRetrieve?.hashValue)
844830
hasher.combine(self.ranking?.hashValue)
845831
hasher.combine(self.relevancyStrictness?.hashValue)
@@ -872,7 +858,6 @@ extension FallbackParams: Hashable {
872858
hasher.combine(self.replaceSynonymsInHighlight?.hashValue)
873859
hasher.combine(self.minProximity?.hashValue)
874860
hasher.combine(self.responseFields?.hashValue)
875-
hasher.combine(self.maxFacetHits?.hashValue)
876861
hasher.combine(self.maxValuesPerFacet?.hashValue)
877862
hasher.combine(self.sortFacetValuesBy?.hashValue)
878863
hasher.combine(self.attributeCriteriaComputedByMinProximity?.hashValue)

0 commit comments

Comments
 (0)