@@ -14,6 +14,9 @@ public struct SourceCommercetools: Codable, JSONEncodable {
1414 public var projectKey : String
1515 /// Whether a fallback value is stored in the Algolia record if there's no inventory information about the product.
1616 public var fallbackIsInStockValue : Bool ?
17+ /// Predicate to filter out specific products when indexing. For more information, see [Query
18+ /// Predicate](https://docs.commercetools.com/api/predicates/query).
19+ public var productQueryPredicate : String ?
1720 public var customFields : CommercetoolsCustomFields ?
1821
1922 public init (
@@ -22,13 +25,15 @@ public struct SourceCommercetools: Codable, JSONEncodable {
2225 url: String ,
2326 projectKey: String ,
2427 fallbackIsInStockValue: Bool ? = nil ,
28+ productQueryPredicate: String ? = nil ,
2529 customFields: CommercetoolsCustomFields ? = nil
2630 ) {
2731 self . storeKeys = storeKeys
2832 self . locales = locales
2933 self . url = url
3034 self . projectKey = projectKey
3135 self . fallbackIsInStockValue = fallbackIsInStockValue
36+ self . productQueryPredicate = productQueryPredicate
3237 self . customFields = customFields
3338 }
3439
@@ -38,6 +43,7 @@ public struct SourceCommercetools: Codable, JSONEncodable {
3843 case url
3944 case projectKey
4045 case fallbackIsInStockValue
46+ case productQueryPredicate
4147 case customFields
4248 }
4349
@@ -50,6 +56,7 @@ public struct SourceCommercetools: Codable, JSONEncodable {
5056 try container. encode ( self . url, forKey: . url)
5157 try container. encode ( self . projectKey, forKey: . projectKey)
5258 try container. encodeIfPresent ( self . fallbackIsInStockValue, forKey: . fallbackIsInStockValue)
59+ try container. encodeIfPresent ( self . productQueryPredicate, forKey: . productQueryPredicate)
5360 try container. encodeIfPresent ( self . customFields, forKey: . customFields)
5461 }
5562}
@@ -61,6 +68,7 @@ extension SourceCommercetools: Equatable {
6168 lhs. url == rhs. url &&
6269 lhs. projectKey == rhs. projectKey &&
6370 lhs. fallbackIsInStockValue == rhs. fallbackIsInStockValue &&
71+ lhs. productQueryPredicate == rhs. productQueryPredicate &&
6472 lhs. customFields == rhs. customFields
6573 }
6674}
@@ -72,6 +80,7 @@ extension SourceCommercetools: Hashable {
7280 hasher. combine ( self . url. hashValue)
7381 hasher. combine ( self . projectKey. hashValue)
7482 hasher. combine ( self . fallbackIsInStockValue? . hashValue)
83+ hasher. combine ( self . productQueryPredicate? . hashValue)
7584 hasher. combine ( self . customFields? . hashValue)
7685 }
7786}
0 commit comments