Services Plugins FAQs

Algolia Search v2.0 - Results blocked by a JS error

Hi,

When trying your Algolia Search tutorial, following error is displayed on preview by the debug tool:

General error
Bug in custom code TypeError: Cannot destructure property ‘hits’ of ‘res’ as it is undefined.
at data.processHits [as callback] (PLUGIN_1540375783191x449334306062991400/Algolia-Search-V2-0-initialize–Algolia-Simple-Search-.js:26:17)
at https://cdn.jsdelivr.net/algoliasearch/3/algoliasearch.min.js:3:5307
at root (PLUGIN_1540375783191x449334306062991400/Algolia-Search-V2-0-initialize–Algolia-Simple-Search-.js:26:17)

Can you help ?
Thank you in advance,

Stephane

Hello, @stephane.ma
Thanks for your question.

Can you please let me know if you enabled these checkboxes in your settings tab:

Also, I’m afraid that I can’t provide you with an exact answer without more details about your settings.
Please share some screenshots with the correct plugin element settings.

As an important point, in the plugin’s documentation, we also mentioned, that in order to have the filtering option from the „Algolia Search” element working it is needed to set up filtering and faceting in Algolia Dashboard. Steps for setting up filtering and faceting:

  1. Open in your Algolia dashboard, find tab “configuration”. (image)
  2. Select “Searchable attributes” and add there all the needed attributes by which you want to filter. (image)
  3. Select “Facets” and add there all the needed attributes by which you want to filter. (image)

Please check it and let me know about the result.
Best regards,

Hi Ecaterina,

Thank you for your help !

I’ve now enabled the 2 API checkboxes and also checked the algolia setup : 2 searchable attributes (title, description) and one facet (category).
But the js error still occurs each time I hit a character in search field linked to the Algolia element.

PS: In Settings, please note that in Settings, ‘Search with Algolia’ is not checked (I would need a Professional Plan for that, but I’ve got a Personal one).

Best regards,

Stephane

Hello, @stephane.ma
Thanks for the details.

Please check in your Algolia Dashboard if you established searching fields since your plugin element didn’t receive any information from the platform.
Thus, please check these screenshots and check if there are searching variables in your Algolia Dashboard:


Hope it will help you.
Best regards,