Skip to content

Commit

Permalink
fix(specs): move customRanking and keepDiacriticsOnCharacters to inde…
Browse files Browse the repository at this point in the history
…xSettings [skip-bc] (generated)

algolia/api-clients-automation#4324

Co-authored-by: algolia-bot <[email protected]>
Co-authored-by: Pierre Millot <[email protected]>
  • Loading branch information
algolia-bot and millotp committed Jan 9, 2025
1 parent 2525b8c commit c5b8ab2
Show file tree
Hide file tree
Showing 14 changed files with 179 additions and 208 deletions.
25 changes: 25 additions & 0 deletions Sources/Recommend/Models/FallbackParams.swift
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,19 @@ public struct FallbackParams: Codable, JSONEncodable {
/// Maximum number of facet values to return when [searching for facet
/// values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values).
public var maxFacetHits: Int?
/// Characters for which diacritics should be preserved. By default, Algolia removes diacritics from letters. For
/// example, `é` becomes `e`. If this causes issues in your search, you can specify characters that should keep
/// their diacritics.
public var keepDiacriticsOnCharacters: String?
/// Attributes to use as [custom
/// ranking](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/). Attribute names are
/// case-sensitive. The custom ranking attributes decide which items are shown first if the other ranking criteria
/// are equal. Records with missing values for your selected custom ranking attributes are always sorted last.
/// Boolean attributes are sorted based on their alphabetical order. **Modifiers** - `asc(\"ATTRIBUTE\")`. Sort
/// the index by the values of an attribute, in ascending order. - `desc(\"ATTRIBUTE\")`. Sort the index by the
/// values of an attribute, in descending order. If you use two or more custom ranking attributes, [reduce the precision](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/how-to/controlling-custom-ranking-metrics-precision/)
/// of your first attributes, or the other attributes will never be applied.
public var customRanking: [String]?
/// Attributes to include in the API response. To reduce the size of your response, you can retrieve only some of
/// the attributes. Attribute names are case-sensitive. - `*` retrieves all attributes, except attributes included
/// in the `customRanking` and `unretrievableAttributes` settings. - To retrieve all attributes except a specific
Expand Down Expand Up @@ -375,6 +388,8 @@ public struct FallbackParams: Codable, JSONEncodable {
customNormalization: [String: [String: String]]? = nil,
attributeForDistinct: String? = nil,
maxFacetHits: Int? = nil,
keepDiacriticsOnCharacters: String? = nil,
customRanking: [String]? = nil,
attributesToRetrieve: [String]? = nil,
ranking: [String]? = nil,
relevancyStrictness: Int? = nil,
Expand Down Expand Up @@ -461,6 +476,8 @@ public struct FallbackParams: Codable, JSONEncodable {
self.customNormalization = customNormalization
self.attributeForDistinct = attributeForDistinct
self.maxFacetHits = maxFacetHits
self.keepDiacriticsOnCharacters = keepDiacriticsOnCharacters
self.customRanking = customRanking
self.attributesToRetrieve = attributesToRetrieve
self.ranking = ranking
self.relevancyStrictness = relevancyStrictness
Expand Down Expand Up @@ -549,6 +566,8 @@ public struct FallbackParams: Codable, JSONEncodable {
case customNormalization
case attributeForDistinct
case maxFacetHits
case keepDiacriticsOnCharacters
case customRanking
case attributesToRetrieve
case ranking
case relevancyStrictness
Expand Down Expand Up @@ -640,6 +659,8 @@ public struct FallbackParams: Codable, JSONEncodable {
try container.encodeIfPresent(self.customNormalization, forKey: .customNormalization)
try container.encodeIfPresent(self.attributeForDistinct, forKey: .attributeForDistinct)
try container.encodeIfPresent(self.maxFacetHits, forKey: .maxFacetHits)
try container.encodeIfPresent(self.keepDiacriticsOnCharacters, forKey: .keepDiacriticsOnCharacters)
try container.encodeIfPresent(self.customRanking, forKey: .customRanking)
try container.encodeIfPresent(self.attributesToRetrieve, forKey: .attributesToRetrieve)
try container.encodeIfPresent(self.ranking, forKey: .ranking)
try container.encodeIfPresent(self.relevancyStrictness, forKey: .relevancyStrictness)
Expand Down Expand Up @@ -736,6 +757,8 @@ extension FallbackParams: Equatable {
lhs.customNormalization == rhs.customNormalization &&
lhs.attributeForDistinct == rhs.attributeForDistinct &&
lhs.maxFacetHits == rhs.maxFacetHits &&
lhs.keepDiacriticsOnCharacters == rhs.keepDiacriticsOnCharacters &&
lhs.customRanking == rhs.customRanking &&
lhs.attributesToRetrieve == rhs.attributesToRetrieve &&
lhs.ranking == rhs.ranking &&
lhs.relevancyStrictness == rhs.relevancyStrictness &&
Expand Down Expand Up @@ -826,6 +849,8 @@ extension FallbackParams: Hashable {
hasher.combine(self.customNormalization?.hashValue)
hasher.combine(self.attributeForDistinct?.hashValue)
hasher.combine(self.maxFacetHits?.hashValue)
hasher.combine(self.keepDiacriticsOnCharacters?.hashValue)
hasher.combine(self.customRanking?.hashValue)
hasher.combine(self.attributesToRetrieve?.hashValue)
hasher.combine(self.ranking?.hashValue)
hasher.combine(self.relevancyStrictness?.hashValue)
Expand Down
29 changes: 27 additions & 2 deletions Sources/Recommend/Models/RecommendBaseIndexSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,19 @@ public struct RecommendBaseIndexSettings: Codable, JSONEncodable {
/// Maximum number of facet values to return when [searching for facet
/// values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values).
public var maxFacetHits: Int?
/// Characters for which diacritics should be preserved. By default, Algolia removes diacritics from letters. For
/// example, `é` becomes `e`. If this causes issues in your search, you can specify characters that should keep
/// their diacritics.
public var keepDiacriticsOnCharacters: String?
/// Attributes to use as [custom
/// ranking](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/). Attribute names are
/// case-sensitive. The custom ranking attributes decide which items are shown first if the other ranking criteria
/// are equal. Records with missing values for your selected custom ranking attributes are always sorted last.
/// Boolean attributes are sorted based on their alphabetical order. **Modifiers** - `asc(\"ATTRIBUTE\")`. Sort
/// the index by the values of an attribute, in ascending order. - `desc(\"ATTRIBUTE\")`. Sort the index by the
/// values of an attribute, in descending order. If you use two or more custom ranking attributes, [reduce the precision](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/how-to/controlling-custom-ranking-metrics-precision/)
/// of your first attributes, or the other attributes will never be applied.
public var customRanking: [String]?

public init(
attributesForFaceting: [String]? = nil,
Expand All @@ -121,7 +134,9 @@ public struct RecommendBaseIndexSettings: Codable, JSONEncodable {
userData: AnyCodable? = nil,
customNormalization: [String: [String: String]]? = nil,
attributeForDistinct: String? = nil,
maxFacetHits: Int? = nil
maxFacetHits: Int? = nil,
keepDiacriticsOnCharacters: String? = nil,
customRanking: [String]? = nil
) {
self.attributesForFaceting = attributesForFaceting
self.replicas = replicas
Expand All @@ -141,6 +156,8 @@ public struct RecommendBaseIndexSettings: Codable, JSONEncodable {
self.customNormalization = customNormalization
self.attributeForDistinct = attributeForDistinct
self.maxFacetHits = maxFacetHits
self.keepDiacriticsOnCharacters = keepDiacriticsOnCharacters
self.customRanking = customRanking
}

public enum CodingKeys: String, CodingKey, CaseIterable {
Expand All @@ -162,6 +179,8 @@ public struct RecommendBaseIndexSettings: Codable, JSONEncodable {
case customNormalization
case attributeForDistinct
case maxFacetHits
case keepDiacriticsOnCharacters
case customRanking
}

// Encodable protocol methods
Expand All @@ -186,6 +205,8 @@ public struct RecommendBaseIndexSettings: Codable, JSONEncodable {
try container.encodeIfPresent(self.customNormalization, forKey: .customNormalization)
try container.encodeIfPresent(self.attributeForDistinct, forKey: .attributeForDistinct)
try container.encodeIfPresent(self.maxFacetHits, forKey: .maxFacetHits)
try container.encodeIfPresent(self.keepDiacriticsOnCharacters, forKey: .keepDiacriticsOnCharacters)
try container.encodeIfPresent(self.customRanking, forKey: .customRanking)
}
}

Expand All @@ -208,7 +229,9 @@ extension RecommendBaseIndexSettings: Equatable {
lhs.userData == rhs.userData &&
lhs.customNormalization == rhs.customNormalization &&
lhs.attributeForDistinct == rhs.attributeForDistinct &&
lhs.maxFacetHits == rhs.maxFacetHits
lhs.maxFacetHits == rhs.maxFacetHits &&
lhs.keepDiacriticsOnCharacters == rhs.keepDiacriticsOnCharacters &&
lhs.customRanking == rhs.customRanking
}
}

Expand All @@ -232,5 +255,7 @@ extension RecommendBaseIndexSettings: Hashable {
hasher.combine(self.customNormalization?.hashValue)
hasher.combine(self.attributeForDistinct?.hashValue)
hasher.combine(self.maxFacetHits?.hashValue)
hasher.combine(self.keepDiacriticsOnCharacters?.hashValue)
hasher.combine(self.customRanking?.hashValue)
}
}
25 changes: 25 additions & 0 deletions Sources/Recommend/Models/RecommendIndexSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,19 @@ public struct RecommendIndexSettings: Codable, JSONEncodable {
/// Maximum number of facet values to return when [searching for facet
/// values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values).
public var maxFacetHits: Int?
/// Characters for which diacritics should be preserved. By default, Algolia removes diacritics from letters. For
/// example, `é` becomes `e`. If this causes issues in your search, you can specify characters that should keep
/// their diacritics.
public var keepDiacriticsOnCharacters: String?
/// Attributes to use as [custom
/// ranking](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/). Attribute names are
/// case-sensitive. The custom ranking attributes decide which items are shown first if the other ranking criteria
/// are equal. Records with missing values for your selected custom ranking attributes are always sorted last.
/// Boolean attributes are sorted based on their alphabetical order. **Modifiers** - `asc(\"ATTRIBUTE\")`. Sort
/// the index by the values of an attribute, in ascending order. - `desc(\"ATTRIBUTE\")`. Sort the index by the
/// values of an attribute, in descending order. If you use two or more custom ranking attributes, [reduce the precision](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/how-to/controlling-custom-ranking-metrics-precision/)
/// of your first attributes, or the other attributes will never be applied.
public var customRanking: [String]?
/// Attributes to include in the API response. To reduce the size of your response, you can retrieve only some of
/// the attributes. Attribute names are case-sensitive. - `*` retrieves all attributes, except attributes included
/// in the `customRanking` and `unretrievableAttributes` settings. - To retrieve all attributes except a specific
Expand Down Expand Up @@ -260,6 +273,8 @@ public struct RecommendIndexSettings: Codable, JSONEncodable {
customNormalization: [String: [String: String]]? = nil,
attributeForDistinct: String? = nil,
maxFacetHits: Int? = nil,
keepDiacriticsOnCharacters: String? = nil,
customRanking: [String]? = nil,
attributesToRetrieve: [String]? = nil,
ranking: [String]? = nil,
relevancyStrictness: Int? = nil,
Expand Down Expand Up @@ -317,6 +332,8 @@ public struct RecommendIndexSettings: Codable, JSONEncodable {
self.customNormalization = customNormalization
self.attributeForDistinct = attributeForDistinct
self.maxFacetHits = maxFacetHits
self.keepDiacriticsOnCharacters = keepDiacriticsOnCharacters
self.customRanking = customRanking
self.attributesToRetrieve = attributesToRetrieve
self.ranking = ranking
self.relevancyStrictness = relevancyStrictness
Expand Down Expand Up @@ -376,6 +393,8 @@ public struct RecommendIndexSettings: Codable, JSONEncodable {
case customNormalization
case attributeForDistinct
case maxFacetHits
case keepDiacriticsOnCharacters
case customRanking
case attributesToRetrieve
case ranking
case relevancyStrictness
Expand Down Expand Up @@ -438,6 +457,8 @@ public struct RecommendIndexSettings: Codable, JSONEncodable {
try container.encodeIfPresent(self.customNormalization, forKey: .customNormalization)
try container.encodeIfPresent(self.attributeForDistinct, forKey: .attributeForDistinct)
try container.encodeIfPresent(self.maxFacetHits, forKey: .maxFacetHits)
try container.encodeIfPresent(self.keepDiacriticsOnCharacters, forKey: .keepDiacriticsOnCharacters)
try container.encodeIfPresent(self.customRanking, forKey: .customRanking)
try container.encodeIfPresent(self.attributesToRetrieve, forKey: .attributesToRetrieve)
try container.encodeIfPresent(self.ranking, forKey: .ranking)
try container.encodeIfPresent(self.relevancyStrictness, forKey: .relevancyStrictness)
Expand Down Expand Up @@ -505,6 +526,8 @@ extension RecommendIndexSettings: Equatable {
lhs.customNormalization == rhs.customNormalization &&
lhs.attributeForDistinct == rhs.attributeForDistinct &&
lhs.maxFacetHits == rhs.maxFacetHits &&
lhs.keepDiacriticsOnCharacters == rhs.keepDiacriticsOnCharacters &&
lhs.customRanking == rhs.customRanking &&
lhs.attributesToRetrieve == rhs.attributesToRetrieve &&
lhs.ranking == rhs.ranking &&
lhs.relevancyStrictness == rhs.relevancyStrictness &&
Expand Down Expand Up @@ -566,6 +589,8 @@ extension RecommendIndexSettings: Hashable {
hasher.combine(self.customNormalization?.hashValue)
hasher.combine(self.attributeForDistinct?.hashValue)
hasher.combine(self.maxFacetHits?.hashValue)
hasher.combine(self.keepDiacriticsOnCharacters?.hashValue)
hasher.combine(self.customRanking?.hashValue)
hasher.combine(self.attributesToRetrieve?.hashValue)
hasher.combine(self.ranking?.hashValue)
hasher.combine(self.relevancyStrictness?.hashValue)
Expand Down
25 changes: 25 additions & 0 deletions Sources/Recommend/Models/RecommendSearchParams.swift
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,19 @@ public struct RecommendSearchParams: Codable, JSONEncodable {
/// Maximum number of facet values to return when [searching for facet
/// values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values).
public var maxFacetHits: Int?
/// Characters for which diacritics should be preserved. By default, Algolia removes diacritics from letters. For
/// example, `é` becomes `e`. If this causes issues in your search, you can specify characters that should keep
/// their diacritics.
public var keepDiacriticsOnCharacters: String?
/// Attributes to use as [custom
/// ranking](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/). Attribute names are
/// case-sensitive. The custom ranking attributes decide which items are shown first if the other ranking criteria
/// are equal. Records with missing values for your selected custom ranking attributes are always sorted last.
/// Boolean attributes are sorted based on their alphabetical order. **Modifiers** - `asc(\"ATTRIBUTE\")`. Sort
/// the index by the values of an attribute, in ascending order. - `desc(\"ATTRIBUTE\")`. Sort the index by the
/// values of an attribute, in descending order. If you use two or more custom ranking attributes, [reduce the precision](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/how-to/controlling-custom-ranking-metrics-precision/)
/// of your first attributes, or the other attributes will never be applied.
public var customRanking: [String]?
/// Attributes to include in the API response. To reduce the size of your response, you can retrieve only some of
/// the attributes. Attribute names are case-sensitive. - `*` retrieves all attributes, except attributes included
/// in the `customRanking` and `unretrievableAttributes` settings. - To retrieve all attributes except a specific
Expand Down Expand Up @@ -376,6 +389,8 @@ public struct RecommendSearchParams: Codable, JSONEncodable {
customNormalization: [String: [String: String]]? = nil,
attributeForDistinct: String? = nil,
maxFacetHits: Int? = nil,
keepDiacriticsOnCharacters: String? = nil,
customRanking: [String]? = nil,
attributesToRetrieve: [String]? = nil,
ranking: [String]? = nil,
relevancyStrictness: Int? = nil,
Expand Down Expand Up @@ -462,6 +477,8 @@ public struct RecommendSearchParams: Codable, JSONEncodable {
self.customNormalization = customNormalization
self.attributeForDistinct = attributeForDistinct
self.maxFacetHits = maxFacetHits
self.keepDiacriticsOnCharacters = keepDiacriticsOnCharacters
self.customRanking = customRanking
self.attributesToRetrieve = attributesToRetrieve
self.ranking = ranking
self.relevancyStrictness = relevancyStrictness
Expand Down Expand Up @@ -550,6 +567,8 @@ public struct RecommendSearchParams: Codable, JSONEncodable {
case customNormalization
case attributeForDistinct
case maxFacetHits
case keepDiacriticsOnCharacters
case customRanking
case attributesToRetrieve
case ranking
case relevancyStrictness
Expand Down Expand Up @@ -641,6 +660,8 @@ public struct RecommendSearchParams: Codable, JSONEncodable {
try container.encodeIfPresent(self.customNormalization, forKey: .customNormalization)
try container.encodeIfPresent(self.attributeForDistinct, forKey: .attributeForDistinct)
try container.encodeIfPresent(self.maxFacetHits, forKey: .maxFacetHits)
try container.encodeIfPresent(self.keepDiacriticsOnCharacters, forKey: .keepDiacriticsOnCharacters)
try container.encodeIfPresent(self.customRanking, forKey: .customRanking)
try container.encodeIfPresent(self.attributesToRetrieve, forKey: .attributesToRetrieve)
try container.encodeIfPresent(self.ranking, forKey: .ranking)
try container.encodeIfPresent(self.relevancyStrictness, forKey: .relevancyStrictness)
Expand Down Expand Up @@ -737,6 +758,8 @@ extension RecommendSearchParams: Equatable {
lhs.customNormalization == rhs.customNormalization &&
lhs.attributeForDistinct == rhs.attributeForDistinct &&
lhs.maxFacetHits == rhs.maxFacetHits &&
lhs.keepDiacriticsOnCharacters == rhs.keepDiacriticsOnCharacters &&
lhs.customRanking == rhs.customRanking &&
lhs.attributesToRetrieve == rhs.attributesToRetrieve &&
lhs.ranking == rhs.ranking &&
lhs.relevancyStrictness == rhs.relevancyStrictness &&
Expand Down Expand Up @@ -827,6 +850,8 @@ extension RecommendSearchParams: Hashable {
hasher.combine(self.customNormalization?.hashValue)
hasher.combine(self.attributeForDistinct?.hashValue)
hasher.combine(self.maxFacetHits?.hashValue)
hasher.combine(self.keepDiacriticsOnCharacters?.hashValue)
hasher.combine(self.customRanking?.hashValue)
hasher.combine(self.attributesToRetrieve?.hashValue)
hasher.combine(self.ranking?.hashValue)
hasher.combine(self.relevancyStrictness?.hashValue)
Expand Down
Loading

0 comments on commit c5b8ab2

Please sign in to comment.