21 Nov 2018

Plurals

Introduction to Plurals

In some domains, search queries might commonly be split between singular and plural forms — for example, eyeglass ⇄ eyeglasses or foot warmer ⇄ foot warmers ⇄ feet warmers. If not for plural handling, users would need to search for precisely the text in the products, rather than what felt natural.

Note that the inclusion of plurals doesn’t always improve search relevance, and it doesn’t make sense for every use case.

Default Behavior

By default, Algolia does not consider singulars and plurals as matches:

"car"  "cars"
"foot"  "feet"

Ignoring Plurals

Algolia’s default behavior can be changed with the ignorePlurals parameter. When enabled, ignorePlurals will make the engine consider “foot” and “feet” equivalent — they’re considered exact matches with zero typos.

On top of considering plural forms, we also take into account inflected forms due to declensions and diminutives (for languages where these apply). See our full discussion on how we handle plurals, declensions, and diminutives.

This parameter can be:

  • a boolean: enable or disable plurals for all supported languages;
  • an array: list of language ISO codes for which plurals should be enabled.

Note: If you enable ignorePlurals you can also control the list of languages by setting queryLanguages.

Best Practices

For optimal relevance, it’s best to specify an array as the value for ignorePlurals, so that it’s only enabled for languages that are actually used in your data set.

Enabling all languages may cause side effects, with pairs of words being unexpectedly treated as equivalent.

Language Support

ignorePlurals is supported in the following languages, with their associated ISO codes:

Afrikaans=af, Arabic=ar, Azeri=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, Kyrgyz=ky, Lithuanian=lt, Maori=mi, Mongolian=mn, Marathi=mr, Malay=ms, Maltese=mt, Norwegian=nb, Dutch=nl, 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

© Algolia - Privacy Policy