Skip to content

Commit 4d63620

Browse files
committed
MAGE-1241 Add feature enablement check before indexing dynamic facet support data
1 parent e8f7f54 commit 4d63620

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

Helper/Entity/ProductHelper.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,11 +285,14 @@ public function getIndexSettings(?int $storeId = null): array
285285
'customRanking' => $this->getCustomRanking($storeId),
286286
'unretrievableAttributes' => $this->getUnretrieveableAttributes($storeId),
287287
'attributesForFaceting' => $this->facetBuilder->getAttributesForFaceting($storeId),
288-
'renderingContent' => $this->facetBuilder->getRenderingContent($storeId),
289288
'maxValuesPerFacet' => $this->configHelper->getMaxValuesPerFacet($storeId),
290289
'removeWordsIfNoResults' => $this->configHelper->getRemoveWordsIfNoResult($storeId),
291290
];
292291

292+
if ($this->configHelper->isDynamicFacetsEnabled($storeId)) {
293+
$indexSettings['renderingContent'] = $this->facetBuilder->getRenderingContent($storeId);
294+
}
295+
293296
// Additional index settings from event observer
294297
$transport = new DataObject($indexSettings);
295298
// Only for backward compatibility

etc/adminhtml/system.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,14 @@
443443
While the rendering of facets is configured based on your Magento admin settings, it is possible to override
444444
these settings via merchandising rules in Algolia. Enable "dynamic facets" to allow InstantSearch
445445
to render facets based on the rule conditions you define in either the Algolia Dashboard or Merchandising Studio.
446+
<br><br>
447+
This feature utilizes the "Facet display" configuration in the Algolia Dashboard (a.k.a. <code>renderingContent</code>).
448+
If you have customized this setting in the Dashboard for your products index, please note that enabling this option will allow Magento to overwrite your configuration.
449+
<br><br>
450+
<span class="algolia-config-warning">&#9888;</span>
451+
<strong>IMPORTANT!</strong> Do not enable dynamic facets unless you have the "renderingContent" feature enabled on your Algolia application. Otherwise this configuration
452+
can cause your indexing to fail.
453+
446454
]]>
447455
</comment>
448456
<depends>

view/adminhtml/web/js/config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ require(
1111
// rows
1212
const rowIds = [
1313
'#row_algoliasearch_instant_instant_facets_facets',
14-
'#row_algoliasearch_instant_instant_facets_max_values_per_facet'
14+
'#row_algoliasearch_instant_instant_facets_max_values_per_facet',
15+
'#row_algoliasearch_instant_instant_facets_enable_dynamic_facets'
1516
];
1617

1718
let rowWarning = '<div class="algolia_dashboard_warning">';

0 commit comments

Comments
 (0)