The Magento extension caps the max record size to 10kb by default.
If your Algolia plan includes a higher max record size allowance, you can increase this value in the extension by following the steps below:
Customizing the record size limit#
By default, the user can fetch the max record size limit set in the extension by calling the method Algolia\AlgoliaSearch\Helper\ConfigHelper::getMaxRecordSizeLimit()
.
The method returns the DEFAULT_MAX_RECORD_SIZE
constant defined in the same class, which is set to 10000
.
1 2 3 4 |
public function getDefaultMaxRecordSize() { return self::DEFAULT_MAX_RECORD_SIZE; } |
This method is public, that means that you can use a standard Magento plugin to override this value.
Create a custom module
First, you need to create a custom module where you can register and implement the custom behavior. To achieve this, you can look at the guide on creating a custom extension.
Register the plugin
Create a etc/di.xml
file with the following code:
1 2 3 4 5 6 |
<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Algolia\AlgoliaSearch\Helper\ConfigHelper"> <plugin name="algoliaUpdateMaxRecordSize" type="Algolia\CustomAlgolia\Plugin\ConfigHelperPlugin"/> </type> </config> |
Create the Plugin
Now, create the plugin class in the Plugin/ConfigHelperPlugin.php
file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
<?php namespace Algolia\CustomAlgolia\Plugin; use Algolia\AlgoliaSearch\Helper\ConfigHelper; class ConfigHelperPlugin { public function afterGetMaxRecordSizeLimit(ConfigHelper $subject, $result) { // You can either return a new value or add a custom logic if that's needed return 20000; } } |
Clean the Magento cache, and you’re all set.
Increase the max record size limit in Magento Admin panel
For extension version 3.9.1 and up, you can follow this guide here.
Comments
0 comments
Article is closed for comments.