Skip to content

Commit 49c8c27

Browse files
committed
MAGE-1281 Add config to forward primary index settings to replicas
1 parent 13ac5eb commit 49c8c27

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

Helper/ConfigHelper.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1362,6 +1362,15 @@ public function getWriteTimeout($storeId = null)
13621362
return $this->configInterface->getValue(self::WRITE_TIMEOUT, ScopeInterface::SCOPE_STORE, $storeId);
13631363
}
13641364

1365+
public function shouldForwardPrimaryIndexSettingsToReplicas(?int $storeId = null): bool
1366+
{
1367+
return $this->configInterface->isSetFlag(
1368+
self::FORWARD_TO_REPLICAS,
1369+
ScopeInterface::SCOPE_STORE,
1370+
$storeId
1371+
);
1372+
}
1373+
13651374
public function isAutoPriceIndexingEnabled(?int $storeId = null): bool
13661375
{
13671376
return $this->configInterface->isSetFlag(

etc/adminhtml/system.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1522,6 +1522,17 @@
15221522
<field id="write_timeout" translate="label comment" type="text" sortOrder="110" showInDefault="1">
15231523
<label>Write Timeout (In Seconds)</label>
15241524
</field>
1525+
<field id="forward_to_replicas" translate="label comment" type="select" sortOrder="115" showInDefault="1" showInWebsite="1" showInStore="1">
1526+
<label>Forward index settings to replicas</label>
1527+
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
1528+
<comment>
1529+
<![CDATA[
1530+
When this configuration is enabled, settings that are changed in Algolia on the primary index will also be forwarded to its replica indices. It is enabled by default.
1531+
<br><br>
1532+
The ability to disable this behavior is retained for legacy implementations, but it is highly recommended that you leave this setting enabled especially if you are using dynamic facets.
1533+
]]>
1534+
</comment>
1535+
</field>
15251536
<field id="auto_price_indexing" translate="label comment" type="select" sortOrder="120" showInDefault="1" showInWebsite="1" showInStore="1">
15261537
<label>Enable automatic price indexing</label>
15271538
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>

etc/config.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@
122122
<connection_timeout>2</connection_timeout>
123123
<read_timeout>30</read_timeout>
124124
<write_timeout>30</write_timeout>
125+
<forward_to_replicas>1</forward_to_replicas>
125126
<auto_price_indexing>0</auto_price_indexing>
126127
<enable_profiler>0</enable_profiler>
127128
</advanced>

0 commit comments

Comments
 (0)