@@ -14,6 +14,9 @@ public struct SourceCommercetools: Codable, JSONEncodable {
14
14
public var projectKey : String
15
15
/// Whether a fallback value is stored in the Algolia record if there's no inventory information about the product.
16
16
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 ?
17
20
public var customFields : CommercetoolsCustomFields ?
18
21
19
22
public init (
@@ -22,13 +25,15 @@ public struct SourceCommercetools: Codable, JSONEncodable {
22
25
url: String ,
23
26
projectKey: String ,
24
27
fallbackIsInStockValue: Bool ? = nil ,
28
+ productQueryPredicate: String ? = nil ,
25
29
customFields: CommercetoolsCustomFields ? = nil
26
30
) {
27
31
self . storeKeys = storeKeys
28
32
self . locales = locales
29
33
self . url = url
30
34
self . projectKey = projectKey
31
35
self . fallbackIsInStockValue = fallbackIsInStockValue
36
+ self . productQueryPredicate = productQueryPredicate
32
37
self . customFields = customFields
33
38
}
34
39
@@ -38,6 +43,7 @@ public struct SourceCommercetools: Codable, JSONEncodable {
38
43
case url
39
44
case projectKey
40
45
case fallbackIsInStockValue
46
+ case productQueryPredicate
41
47
case customFields
42
48
}
43
49
@@ -50,6 +56,7 @@ public struct SourceCommercetools: Codable, JSONEncodable {
50
56
try container. encode ( self . url, forKey: . url)
51
57
try container. encode ( self . projectKey, forKey: . projectKey)
52
58
try container. encodeIfPresent ( self . fallbackIsInStockValue, forKey: . fallbackIsInStockValue)
59
+ try container. encodeIfPresent ( self . productQueryPredicate, forKey: . productQueryPredicate)
53
60
try container. encodeIfPresent ( self . customFields, forKey: . customFields)
54
61
}
55
62
}
@@ -61,6 +68,7 @@ extension SourceCommercetools: Equatable {
61
68
lhs. url == rhs. url &&
62
69
lhs. projectKey == rhs. projectKey &&
63
70
lhs. fallbackIsInStockValue == rhs. fallbackIsInStockValue &&
71
+ lhs. productQueryPredicate == rhs. productQueryPredicate &&
64
72
lhs. customFields == rhs. customFields
65
73
}
66
74
}
@@ -72,6 +80,7 @@ extension SourceCommercetools: Hashable {
72
80
hasher. combine ( self . url. hashValue)
73
81
hasher. combine ( self . projectKey. hashValue)
74
82
hasher. combine ( self . fallbackIsInStockValue? . hashValue)
83
+ hasher. combine ( self . productQueryPredicate? . hashValue)
75
84
hasher. combine ( self . customFields? . hashValue)
76
85
}
77
86
}
0 commit comments