Please note that this Support article contains frontend customizations via modifying the legacy Algolia template files, which are deprecated and unsupported by the Algolia Support Team.
For more information, please review this Support article - "Why is modifying Algolia template files for customizations not supported?"
When building a Search experience on your Shopify store, there might be times where it is necessary to add search parameters to fine tune your Search results.
A typical example of search Parameters are filters, optionalFilters, or ruleContexts. These kinds of search parameters can help you to refine your results and achieve relevance objectives.
Our Shopify plugin provides an integration for two Algolia front-end libraries:
On this guide we will go through the steps to add search parameters to each integration. As an example, we will add the ruleContexts
parameter.
Adding search parameters to the Autocomplete Menu
The implementation steps vary depending on the version of Autocomplete you're using. You can find instructions for both Autocomplete V0 and Autocomplete V1 below.
Autocomplete V0
In Autocomplete V0 you can add the parameter to theassets/algolia_autocomplete.js.liquid
file, under the searchOpts
object:
Autocomplete V1
In Autocomplete V1 you can add the parameter to the assets/algolia_autocomplete_product_plugin.js.liquid
file, under the params
object:
Adding search parameters to InstantSearch
In InstantSearch you can add the parameter to theassets/algolia_instant_search.js.liquid
file, on the configure widget: