Icon relevance white

Stop Words

Last updated 12 October 2017

Stop Words Overview

Stop words are very common words in a given language. In English, these would be words like the, and, at, with and as. By default, the engine does not remove stop words.

Removing Stop Words

The removeStopWords parameter can be used to remove stop words from the query before executing a search:

"what is a record" ➡️ "record"

The parameter’s value can be one of:

  • a boolean: true or false, enable or disable stop words for all supported languages
  • an array: a list of language ISO codes for which stop word removal should be enabled. For example, ["en", "es"] would remove stop words in English and Spanish.

Setting removeStopWords to an array value is recommended, because using simply true can lead to false positives.

The behavior of removeStopWords also depends on the queryType parameter:

  • queryType = prefixLast: the query’s last word is treated as a prefix, and won’t be considered for stop word removal

  • queryType = prefixNone no query word is treated as a prefix, so every query word is considered for stop word removal

  • queryType = prefixAll: all query words are treated as prefixes; no stop words will be removed

Stop word removal is supported in the following languages, with their associated ISO codes:

Arabic=ar, Armenian=hy, Basque=eu, Bengali=bn, Brazilian=pt-br, Bulgarian=bg, Catalan=ca, Chinese=zh, Czech=cs, Danish=da, Dutch=nl, English=en, Finnish=fi, French=fr, Galician=gl, German=de, Greek=el, Hindi=hi, Hungarian=hu, Indonesian=id, Irish=ga, Italian=it, Japanese=ja, Korean=ko, Kurdish=ku, Latvian=lv, Lithuanian=lt, Marathi=mr, Norwegian=no, Persian (Farsi)=fa, Polish=pl, Portugese=pt, Romanian=ro, Russian=ru, Slovak=sk, Spanish=es, Swedish=sv, Thai=th, Turkish=tr, Ukranian=uk, Urdu=ur

When to Use Stop Words

In specific cases, removeStopWords can be helpful in removing false positives from search results, especially when combined with optionalWords and removeWordsIfNoResults. However, for most use cases, we don’t recommend enabling it, as users already tend to naturally omit stop words in their queries.

What’s Next

Continue building your Algolia knowledge with these concepts:

© Algolia - Privacy Policy