Integrations / Platforms / Magento 2 / FAQ
Jul. 29, 2019

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.

Sorting configuration

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.

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 findable 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 versio 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.

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.

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.

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 > 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 Query Rules you’re allowed to use may be limited, depending on your plan.

The extension only creates Query Rules when explicitly configured to do so. Query Rules can be configured in the Facets configuration.

To solve this error, either reduce the amount of Query Rules in use, 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

Categories

Pages

Query Suggestions

Additional Sections

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.

Did you find this page helpful?