@@ -34,7 +34,8 @@ public function __construct(
34
34
{}
35
35
36
36
/**
37
- * @param int $storeId
37
+ * Return the configuration to be used for the store product index `attributesForFaceting`
38
+ * @param int $storeId - The store ID for the index to be configured
38
39
* @return string[]
39
40
* @throws LocalizedException
40
41
* @throws NoSuchEntityException
@@ -50,7 +51,8 @@ function($facet) {
50
51
}
51
52
52
53
/**
53
- * @param int $storeId
54
+ * Return the configuration to be used for the store product index `renderingContent`
55
+ * @param int $storeId - The store ID for the index to be configured
54
56
* @return array<string, array>|null
55
57
* @throws LocalizedException
56
58
* @throws NoSuchEntityException
@@ -73,6 +75,8 @@ public function getRenderingContent(int $storeId): ?array
73
75
}
74
76
75
77
/**
78
+ * For an array of facet data, return an array of attribute names only
79
+ *
76
80
* @param array<array<string, mixed>> $facets
77
81
* @return string[]
78
82
*/
@@ -87,8 +91,9 @@ function($facet) {
87
91
}
88
92
89
93
/**
94
+ * Format the facet data to be : renderingContent > facetOrdering > values
90
95
* @param string[] $attributes
91
- * @return array<string, array>
96
+ * @return array<string, array> - Array key is the attribute name and the value is an object containing a `sortRemainingBy` value
92
97
*/
93
98
protected function getRenderingContentValues (array $ attributes ): array
94
99
{
@@ -99,6 +104,7 @@ protected function getRenderingContentValues(array $attributes): array
99
104
}
100
105
101
106
/**
107
+ * Take raw facet (common) attributes and convert to include attributes specifically needed for `renderingContent`
102
108
* @param string[] $facets
103
109
* @return string[]
104
110
*/
@@ -128,9 +134,11 @@ protected function getCategoryAttributeNameForRenderingContent(): string
128
134
}
129
135
130
136
/**
137
+ * Return an associative array for an attribute that mimics the minimum structure used by the Magento configuration
138
+ *
131
139
* @param string $attribute
132
140
* @param bool $searchable
133
- * @return array< string, string>
141
+ * @return array{attribute: string, searchable: string}
134
142
*/
135
143
protected function getRawFacet (string $ attribute , bool $ searchable = false ): array
136
144
{
@@ -141,7 +149,7 @@ protected function getRawFacet(string $attribute, bool $searchable = false): arr
141
149
}
142
150
143
151
/**
144
- * Generates common data to be used for both attributesForFaceting and renderingContent
152
+ * Generates common data to be used for both ` attributesForFaceting` and ` renderingContent`
145
153
*
146
154
* @return array<array<string, mixed>>
147
155
* @throws NoSuchEntityException
@@ -174,6 +182,8 @@ function(string $attribute) {
174
182
}
175
183
176
184
/**
185
+ * Does a given array of facets include a category facet?
186
+ *
177
187
* @param array<array<string, mixed>> $facets
178
188
* @return bool
179
189
*/
@@ -186,7 +196,7 @@ protected function hasCategoryFacet(array $facets): bool
186
196
187
197
/**
188
198
* Applies the category facet if not manually configured but necessary for category functionality
189
- * (The presence of the category facet drives logic for attributesForFaceting and renderingContent)
199
+ * (The presence of the category facet drives logic for ` attributesForFaceting` and ` renderingContent` )
190
200
*
191
201
* @param int $storeId
192
202
* @param array<array<string, mixed>> $facets
@@ -204,7 +214,7 @@ protected function assertCategoryFacet(int $storeId, array $facets): array
204
214
}
205
215
206
216
/**
207
- * Add merchandising facets as needed for attributesForFaceting
217
+ * Add merchandising facets as needed for ` attributesForFaceting`
208
218
*
209
219
* @param int $storeId
210
220
* @param array<array<string, mixed>> $facets
@@ -228,6 +238,8 @@ protected function addMerchandisingFacets(int $storeId, array $facets): array
228
238
}
229
239
230
240
/**
241
+ * Get an array of pricing attribute names based on currency and customer group configuration
242
+ *
231
243
* @param int $storeId
232
244
* @return string[]
233
245
* @throws NoSuchEntityException
@@ -246,6 +258,8 @@ protected function getPricingAttributes(int $storeId): array
246
258
}
247
259
248
260
/**
261
+ * Get an array of pricing attribute names based on customer group configuration
262
+ *
249
263
* @param int $storeId
250
264
* @param string $currencyCode
251
265
* @return string[]
@@ -271,6 +285,8 @@ protected function getGroupPricingAttributes(int $storeId, string $currencyCode)
271
285
272
286
273
287
/**
288
+ * Format the `attributesForFaceting` values based on modifiers defined at:
289
+ * https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers
274
290
* @param array<string, string|int> $facet
275
291
* @return string
276
292
*/
0 commit comments