FAQ
On this page
- 1. How many records are created?
- 2. Console error after reindexing: “Cannot read property ‘autocomplete’ of undefined”
- 3. 404 not found error in Magento configuration
- 4. Empty index after pressing ‘Reindex’
- 5. Missing products during search
- 6. Products not found by SKU
- 7. Deleted products are still showing up after reindexing
- 8. Huge increase in indexing operations
- 9. Missing images during search
- 10. Algolia on a custom search page template
- 11. Fatal error: Class ‘AlgoliaSearch\Version’ not found in …/AlgoliaHelper.php on line xx
- 12. Links are not indexed correctly
- 13. Image links start with /pub
- 14. Increase in delete operations on Algolia
- 15. ‘No’ values in filters
- 16. indexer.php in indexed URLs
- 17. Error: Rules quota exceeded. Please contact us if you need an extended quota.
- 18. What settings are handled by the Magento dashboard vs Algolia dashboard?
- 19. Create query redirects
- 20. Add Best Sellers to sort order
- 21. Enable partial updates
- 22. URL Parameters added to product links
- 23. WeltPixel layered navigation and other third party plug-ins and modules
- 24. Porto and other themes
- 25. How to increase the max record size limit in the extension?
How many records are created?
To be able to provide fast results, the engine pre-computes a part of the order at indexing time. This means only one sorting is available for a single index. Each additional sort will result in an additional index.
In Magento, this means that by default we create:
- 1 index per store
- 1 index per store per additional sort order (by price, by date, etc.)
To calculate the amount of records this generates, let’s have a look at the following example:
Our Magento webshop has 2 stores (2 languages for example) which both have 100 products. Both stores have additional sorts on price and date, resulting in a total of 4 additional sorts.
Using the scenario above, we would need to index:
Default sorting | 100 * 2 | 200 |
Custom sorting | 100 * 2 * 4 | 800 |
Total records | 1000 |
If the customer group feature is enabled, each customer group will result in an extra index on the pricing sorting. Following the example above, but with a total of 5 customer groups will result in:
Default sorting | 100 * 2 | 200 |
Pricing sorting | 100 * 2 * 2 * 5 | 2000 |
Custom sorting | 100 * 2 * 2 | 400 |
Total records | 2600 |
The amount of records indexed can be lowered by removing some of the sorts. The sorts can be configured in the extensions’ administration panel.
Console error after reindexing: “Cannot read property ‘autocomplete’ of undefined”
This error indicates the extension’s templates were not rendered.
These templates are rendered into the before_body_end
block, please make sure the theme renders this block.
If this block is rendered by the theme, please confirm that symlinks are enabled in Magento’s configuration.
This can be enabled in the administration section by navigating to System > Configuration > Advanced > Developer.
404 not found error in Magento configuration
This issue should be resolved by logging out and logging in to the Magento Administration Panel again.
Empty index after pressing ‘Reindex’
In case the indexing queue is enabled, pressing the ‘Reindex’ button will push indexing jobs to the queue. This means the indexing will happen only when the queue is running, and not immediately when the button is pressed. Please make sure the indexing queue is set up correctly and the amount of items to be indexed do not exceed the limits. More information about the indexing queue can be found here.
Missing products during search
First, make sure the products are properly indexed by Algolia. This can be achieved by navigating to the Explorer, selecting the index containing your products and searching the product.
In case the product shows up in the Explorer, please confirm the product has the right visibility settings. When products are only visible in the Catalog, they will not show up while searching; they will only show up on the instant search page in the category section.
In case the product does not show up in the Explorer, the product is not indexed (properly). Make sure the product adheres to the requirements the extension uses to determine if a product is indexable. If the product meets the set requirements, please hit ‘Reindex’ again.
Should the problem persist, please turn on logging and investigate the log files. This should provide more insights into what’s going on during a reindexing operation.
Products not found by SKU
If a product can’t be found by searching for the products’ SKU, please make sure that the latest version of the extension is installed. When, on the latest version of the extension, the product is still unfindable, please check if SKU is set as a searchable attribute. This can be checked in the Algolia configuration in the Magento back-end.
Deleted products are still showing up after reindexing
If deleted products keep showing up in your search after reindexing, please make sure that the latest version of the extension is installed. If the extension is below version 1.6.0, an issue can arise when directly changing products in the database. Because no Magento hooks are triggered when manipulating the database directly, the extension could not recognize that a product was deleted/edited. Version 1.6.0 contains a fix for this issue, so please update the extension if needed.
Huge increase in indexing operations
Sometimes, it happens that the amount of indexing operations skyrockets (up to 10x the normal amount of indexing operations) without an apparent reason. When digging deeper, a few common problems may arise which causes these spikes.
The most probable reason is an automatic import of products from an ERP system into the catalog by a third-party tool, extension or custom code.
The tool can update a lot of information on the products in the catalog: it can change the stock, the prices and any other information on a product.
All these changes can trigger a save
event in Magento.
the extension listens to these save
events to automatically keep your products up to date. That’s why each change will trigger an indexing operation.
This can become really problematic when the third-party tool, extension or custom code triggers multiple save
events per product.
When it’s updating the price of a product and saving this change, and after that it’s updating the description of the product and saving this change too, the save
event will be fired twice.
This means the extension will update the index twice, even though one time would have been enough.
This can cause a massive spike in the amount of indexing operations.
How to fix it
First of all, identify which plug-in or piece of code triggers all the save events. When the problem is found, try to limit the amount of operations it performs. If this is not possible, try to disable indexing while the process of the tool is running, and enable indexing again when it’s done. When all of the above fails, try to use the indexing queue. The indexing queue will merge jobs if possible to limit the amount of indexing operations.
Some third-party tools bypass the save-mechanism in Magento by updating the database directly. This can cause your indices to be out-of-sync. A full reindex is needed to fix this issue.
Missing images during search
The search on the front of your Magento installation is displayed without going through the Magento back-end. This means the extension has to generate the url for images at indexing time, not at the time of searching. When the extension generates this image, Magento will provide it with a cached and resized version of the image to display. One of the possible reasons that images are missing, is that this cache could not be generated automatically by the Magento installation.
First, please make sure the latest version of the extension is installed. If the version of your extension is lower than 1.5.x, please update.
There are two main reasons why a problem with images would occur.
Images appear and then disappear This problem usually means that the image cache has been dropped. This is often triggered manually from the back-end of Magento (System > Cache Management) or through the command line. When the image cache is cleared, indexed image links become invalid because the file will be nonexistent. A full reindex should fix this problem.
Images are not showing at all This problem usually means one of two things. Either there is an issue with the directory permissions, or there’s a memory issue.
First, make sure the media/
directory has the correct permissions. The permissions should be set to 770/660
.
If this doesn’t work, enable logging.
With logging enabled, run a full reindex and open the log file after to see what’s going wrong. If nothing useful comes from the log files, please check the Magento and Apache/Nginx log files as well to check if the problem lies there.
Algolia on a custom search page template
The realtime search experience is implemented using Javascript in the users’ browser. This means the realtime search does not have access to the templates of your theme, and the search results are not yet available in the PHP code of the theme.
To customize the design of the InstantSearch results page and the autocomplete menu, please check this guide.
Fatal error: Class ‘AlgoliaSearch\Version’ not found in …/AlgoliaHelper.php on line xx
When this error occurs, the extension is probably installed incorrectly. There are two supported ways to install the extension, Composer and the Component Manager. Please reinstall the extension according to these instructions.
Links are not indexed correctly
Sometimes, links of the Magento installation can show up with an additional /magento/
in the url.
Most likely, this is because web server rewrites are turned off.
Navigate to Stores > Configuration > General > Web > Search Engine Optimization and set the field Use Web Server Rewrites to Yes.
When this setting is updated, a full reindex is required for the changes to take effect.
Image links start with /pub
This error can occur when your app has the pub/
directory as the root directory for the Magento installation.
This is usually considered a good practice, but it has some drawbacks.
The extension can’t know which directory is the root folder for Magento, so it always assume the base directory is your root folder.
The best way to handle this problem is to make your server ignore /pub
in the url.
If it’s not possible to change the server configuration, a setting is provided in Stores > Configuration > Algolia Search > Advanced > Remove /pub/ from image URLs. When this setting is changed, please reindex the catalog.
Increase in delete operations on Algolia
To make sure the extension only indexes products which are supposed to be indexed, all the products are processed when performing a reindex without the indexing queue enabled.
If a product being processed is disabled, out of stock, or invisible, the delete
operation is performed in Algolia, even if the product is not present in the Algolia index at all.
The solution to this problem is to enable the queue. With the queue enabled, only products that meet the requirements are indexed and pushed to Algolia. The indexing queue makes use of atomic reindexing. Because of this, your current index will not be updated: instead, a temporary new index is created. This temporary index will replace your current index when it’s filled with all the correct objects.
‘No’ values in filters
When a product doesn’t have any value assigned to an attribute, the value of this attribute will be automatically set to ‘No’ by Magento. To turn off indexing for ‘No’ values, set the Index empty value setting in your searchable attributes to No for the attributes you want to ignore ‘No’ values for.
Changing any index setting requires a full reindex of all data.
indexer.php in indexed URLs
When server rewrites are turned off in the Magento installation and a reindex is done through the command line, indexer.php
will be added to the urls.
The only way to prevent this, is to turn on server rewrites.
This can be done by navigating to System > Configuration > General > Web > Search Engine Optimalization and setting Use Web Server Rewrites to Yes.
Error: Rules quota exceeded. Please contact us if you need an extended quota.
When trying to update Algolia’s configuration, or reindexing products, this error may occur. This probably means the amount of Rules you’re allowed to use may be limited, depending on your plan.
The extension only creates rules when explicitly configured to do so. Rules can be configured in the Facets configuration.
To solve this error, either reduce the number of rules you are using, or upgrade the plan to get a higher limit through the billing section in the Algolia Dashboard.
What settings are handled by the Magento dashboard vs Algolia dashboard?
Each type of data - products, categories, pages, query suggestions and additional sections - controls a different set of settings when enabled for indexing.
Products
searchableAttributes
customRanking
unretrievableAttributes
attributesForFaceting
maxValuesPerFacet
removeWordsIfNoResults
Categories
Pages
searchableAttributes
:unordered(slug)
,unordered(name)
,unordered(content)
attributesToSnippet
:content:7
Query Suggestions
searchableAttributes
:unordered(query)
customRanking
:desc(popularity)
,desc(number_of_results)
typoTolerance
:false
attributesToRetrieve
:query
removeWordsIfNoResults
:lastWords
Additional Sections
searchableAttributes
:unordered(value)
Any settings that are not in this list can be managed through the Algolia Dashboard.
If you’re a developer, it’s also possible to push settings programmatically by hooking into the algolia_products_index_before_set_settings
event.
Settings applied in the Algolia dashboard will overwrite any settings you do in Magento until a full reindex is performed though Magento. This will reset all the index settings to the settings set in the Magento Dashboard.
Create query redirects
You can create a query redirect by using Magento’s default Search Terms feature. You can find this feature by going to Marketing > Search Terms in your Magento back-office. You can modify a previously searched query or click “Add New Search Term” to create a new query redirect.
Add Best Sellers to sort order
Best Sellers can be added to your sort order configuration in Stores > Configuration > Algolia Search > Instant Search Results Page > Sorts. To add this sort order, click “Add” to add a new row and configure Attribute to ordered_qty
, and set the Sort direction as Descending.
Please note that adding this sort order adds ordered_qty
and total_ordered
attributes to your product objects, aggregated from the sales_order_item
table. This can potentially increase your indexing time.
Enable partial updates
If you need to perform partial updates, you can enable this feature in Stores > Configuration > Algolia Search > Advanced > Partial Updates. This will index your data using the partialUpdateObjects
method instead of saveObjects
. It’s recommended to enable this option if you want to update only some attributes of your records from an external source without overriding Magento data.
URL Parameters added to product links
From version 2 and up, we append URL parameters to the product links in your search if you enable conversion tracking. We do this so we can tie the search to a conversion event using the queryID
parameter. As a best SEO practice, we recommend you to use canonical links for your product pages. You can enable this setting by going to Stores > Configuration > Catalog > Catalog > Search Engine Optimization > Use Canonical Link Meta Tag For Products.
WeltPixel layered navigation and other third party plug-ins and modules
The Algolia Magento extension may not be compatible with other third-party Magento plug-ins and modules dealing with layered navigation, catalog search, or pagination, such as WeltPixel. There’s no support for usage in conjunction with the extension.
Porto and other themes
The Algolia Magento extension supports the Luma theme out of the box as it replaces the top.search
block with its own template. Porto and other themes require a configuration change for autocomplete to work. Go to Stores > Configuration > Algolia Search > Advanced and change the setting for Search input DOM selector. This setting requires the selector of the search input element of your theme.
To display InstantSearch results, the extension uses the .columns
element. If your theme doesn’t include the default .columns
element, you need to change the value for Stores > Configuration > Algolia Search > Instant Search Page Results > DOM Selector to an element that works for your theme.
See the Front end (UI/UX) guide for more information on configuring your frontend to help support your custom theme.
How to increase the max record size limit in the extension?
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.