1
Enable suggestions in Adobe Commerce and Magento Open Source
To nable the suggestions in the Autocomplete menu,
go to Stores > Algolia Search > Autocomplete Menu in your back-office.
Change the suggestions with these settings:

- Number of queries (0 by default): Maximum number of results shown in the autocomplete menu. Setting a value greater than 0 automatically activates the feature.
- Minimum query popularity (1000 by default)
- Minimum number of results per query (2 by default)
2
Get the Magento suggestions to work
Clear the Magento cache and run a suggestions reindex:Check your search to see if the Magento suggestions are showing up.

3
Create an Algolia Query Suggestions index
To create a Query Suggestions index:
- Go to your Algolia dashboard:
- Click Query Suggestions
-
Click New Query Suggestions

-
Choose an index name (this guide uses
query_suggestions_test). - Select the different languages you’re using and the source index (for example, your main product index).
- Click Accept and Continue to create the Query Suggestions index.

4
Replace the default suggestions index with the Query Suggestions index
To use Algolia’s Query Suggestions,
you will need to use the appropriate frontend hooks provided by the extension.You can find some examples of frontend hooks usage in the custom extension guide.For details of how to turn off default suggestions,
see Indexing suggestions.To contain the required frontend hooks,
create a new Magento module (for example
Algolia_CustomAlgolia) or install the freely available starter extension that you can customize further for your app.The Autocomplete library was upgraded from v0 to v1 as of 3.8.0 of the Algolia Search Integration for Magento extension.
Depending on your installed version, a different approach to customization will be required.
In general, it’s best to run the latest version of the extension.
Customize latest version
Query suggestions are implemented by a plugin. To customize, use theafterAutocompletePlugins frontend hook provided by the extension.
Create the view/frontend/web/js/hooks.js file and register it in requirejs-config.js:
JavaScript
JavaScript
- Extract the index of the existing query suggestions plugin that needs replacing.
- Instantiate a new plugin containing the new index for the Query Suggestions data (for example the
query_suggestions_testindex created previously). - Provide all definitions related to presentation and behavior (templates, search parameters, and keyboard navigation).
Customize versions 3.7 and earlier
Use thebeforeAutocompleteSources frontend hook provided by the extension.
In your custom module, create the view/frontend/layout/algolia_search_handle.xml file and add the following to the <head> section:
HTML
view/frontend/web/js/hooks.js file and implement the logic for your hook there, or paste the contents of this gist in the file.
JavaScript
- Map over the different sources of the Autocomplete menu, to find the Magento’s default suggestions source that needs to be replaced.
- Instantiating a new source containing the Query Suggestions data (inside the
query_suggestions_testindex created previously). - Overriding the source with the created data.