🎉 Try the public beta of the new docs site at algolia.com/doc-beta! 🎉
API Reference / API Parameters / ignorePlurals
Type: boolean | list of strings
Engine default: false (plurals and singulars are treated differently)
Parameter syntax
'ignorePlurals' => true|false|['language ISO code', ...]

Can be used in these methods:

About this parameter

Treats singular, plurals, and other forms of declensions as matching terms.

The ignore plurals functionality (explained here in depth) considers the following forms as equivalent - that is, they match even if they are spelled differently:

  • singular forms
  • plural forms
  • any inflected forms due to declensions (for languages where it applies)

For example, “car” and “cars”, or “foot” and “feet”, are considered equivalent.

Usage notes

  • ignorePlurals is used in conjunction with the queryLanguages setting.

  • You can send ignorePlurals one of 3 values:

    • true, which enables the ignore plurals functionality, where singulars and plurals are considered equivalent (foot = feet). The languages supported here are either every language (this is the default, see list of languages below), or those set by queryLanguages.

    • false, which disables ignore plurals, where singulars and plurals are not considered the same for matching purposes (foot will not find feet).

    • a list of language ISO codes for which ignoring plurals should be enabled. This list will override any values that you may have set in queryLanguages.

  • For optimum relevance, it is highly recommended that you enable only languages that are used in your data. Enabling all languages (setting ignorePlurals to true without setting queryLanguages) may have unintended side effects, with pairs of words being unexpectedly treated as equivalent. For example, the French word “chair” (which means “flesh”) would find “chairs” in an English index.

  • List of supported languages with their associated language ISO code:

    Afrikaans=af
    Arabic=ar
    Azerbaijani=az
    Bulgarian=bg
    Catalan=ca
    Czech=cs
    Welsh=cy
    Danish=da
    German=de
    English=en
    Esperanto=eo
    Spanish=es
    Estonian=et
    Basque=eu
    Finnish=fi
    Faroese=fo
    French=fr
    Galician=gl
    Hebrew=he
    Hindi=hi
    Hungarian=hu
    Armenian=hy
    Indonesian=id
    Icelandic=is
    Italian=it
    Japanese=ja
    Georgian=ka
    Kazakh=kk
    Korean=ko
    Kirghiz=ky
    Lithuanian=lt
    Maori=mi
    Mongolian=mn
    Marathi=mr
    Malay=ms
    Maltese=mt
    Norwegian Bokmål=nb
    Dutch=nl
    Norwegian=no
    Northern Sotho=ns
    Polish=pl
    Pashto=ps
    Portuguese=pt
    Quechua=qu
    Romanian=ro
    Russian=ru
    Slovak=sk
    Albanian=sq
    Swedish=sv
    Swahili=sw
    Tamil=ta
    Telugu=te
    Tagalog=tl
    Tswana=tn
    Turkish=tr
    Tatar=tt
    Ukrainian=uk
    Urdu=ur
    Uzbek=uz
    Chinese=zh

Examples

Set the default Query Languages

In this example, we set Spanish (‘es’) as the default language for ignorePlurals

1
2
3
4
$index->setSettings([
  'queryLanguages' => ['es'],
  'ignorePlurals' => true
]);

Override Query Languages

In this example, we override the Spanish default for ignorePlurals by adding Catalan (‘ca’) to its list of languages.

1
2
3
$results = $index->search('query', [
  'ignorePlurals' => ['ca', 'es']
]);
Did you find this page helpful?