setIgnorePlurals method

AlgoliaQuery setIgnorePlurals(
  1. dynamic value
)

IgnorePlurals

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.

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

    Afrikaans=af Arabic=ar Azerbaijani=az Bulgarian=bg Bengali=bn Catalan=ca Czech=cs Welsh=cy Danish=da German=de Greek=el English=en Esperanto=eo Spanish=es Estonian=et Basque=eu Persian (Farsi)=fa Finnish=fi Faroese=fo French=fr Irish=ga Galician=gl Hebrew=he Hindi=hi Hungarian=hu Armenian=hy Indonesian=id Icelandic=is Italian=it Japanese=ja Georgian=ka Kazakh=kk Korean=ko Kurdish=ku Kirghiz=ky Lithuanian=lt Latvian=lv 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 Brazilian=pt-br Quechua=qu Romanian=ro Russian=ru Slovak=sk Albanian=sq Swedish=sv Swahili=sw Tamil=ta Telugu=te Thai=th Tagalog=tl Tswana=tn Turkish=tr Tatar=tt Ukranian=uk Urdu=ur Uzbek=uz Chinese=zh

Source: Learn more

Implementation

AlgoliaQuery setIgnorePlurals(dynamic value) {
  assert(value != null, 'value can not be empty');
  assert(!_parameters.containsKey('ignorePlurals'),
      '[ignorePlurals] can not be called multiple times.');
  assert(((value is bool) || (value is List<String>)),
      'value must be true|false|["language ISO code", ...]; but value found was `${value.runtimeType}`');
  return _copyWithParameters(<String, dynamic>{'ignorePlurals': value});
}