Set an index's query language
Most of Algolia’s textual matching is language agnostic, meaning the matching and ranking processes are the same for every language. If a search textually matches a record, that record is returned. This approach ensures that Algolia works for any language without any extra customization.
However, there are circumstances where knowledge of the query language is vital for accurate search. For example, by identifying your query language, you can treat plurals and singulars as equivalent. If your users search for “mice”, you most likely don’t want to treat the singular “mouse” as a typo.
Two parameters rely on query language:
ignorePlurals, which treats the singular and plural forms of a word as equivalent (they match even if they’re spelled differently).
removeStopWords, which prevents stop words from being processed as a part of the query. English stop words include “the”, “a”, “an”, “and”. Use
queryLanguagesto set the languages that these parameters use to determine stop words or plurals.
You should always set
indexLanguages for your indices. If you don’t, the engine uses either the default (all supported languages) or the list of languages specified in
This can lead to unexpected search results.
Using the API
To set an index’s language through the API, use the
1 2 3 4 $index->setSettings([ 'queryLanguages' => ['en'], 'ignorePlurals' => true ]);
Using the dashboard
You can also set an index’s query language in your Algolia dashboard:
- Select the Search product icon on your dashboard and then select your index.
- Click on the Configuration tab, then the Language subsection.
- Click Select one or more languages under the Query Languages section, and enter your desired language. You can enter as many languages as you want.
Likewise, you can also set
removeStopWordsin the Algolia dashboard.
- Don’t forget to save your changes.