removeStopWords

Type: boolean | list of strings
Engine default: false
Parameter syntax
'removeStopWords' => true|false|['language ISO code', ...]
Parameter syntax
removeStopWords: true|false|['language ISO code', ...]
Parameter syntax
removeStopWords: true|false|['language ISO code', ...]
Parameter syntax
'removeStopWords': True|False|['language ISO code', ...]
Parameter syntax
"removeStopWords": true|false|["language ISO code", "..."]
Parameter syntax
new JSONObject()
  .put("removeStopWords", true|false)
                          new JSONArray()
                            .put("language ISO code")
                            .put("...")
Parameter syntax
dynamic settings = new JObject();
settings.removeStopWords = true|false|new JArray()
                                        .put("language ISO code")
                                        .put("...");
Parameter syntax
.setRemoveStopWords(true|false|Arrays.asList("language ISO code", "..."))
Parameter syntax
"removeStopWords": true|false|[]string{ "language ISO code", "..." }
Parameter syntax
removeStopWords = Some(true|false)
                  Some(IgnorePlurals.list(Seq(
                    "language ISO code",
                    "..."
                  )))

Can be used in these methods:
search, setSettings, browse, searchForFacetValues, generateSecuredApiKey, addApiKey, updateApiKey search, set_settings, browse, search_for_facet_values, generate_secured_api_key, add_api_key, update_api_key search, setSettings, browse, searchForFacetValues, generateSecuredApiKey, addApiKey, updateApiKey search, set_settings, browse, search_for_facet_values, generate_secured_api_key, add_api_key, update_api_key search, setSettings, browse, searchForFacetValues searchAsync, setSettingsAsync, browseAsync, searchForFacetValues Search, SetSettings, Browse, SearchForFacetValues, GenerateSecuredApiKey, AddApiKey, UpdateApiKey Search, setSettings, browse, searchForFacetValues, generateSecuredApiKey, addApiKey, updateApiKey Search, SetSettings, Browse, SearchForFacetValues, GenerateSecuredAPIKey, AddAPIKey, UpdateAPIKey search, changeSettings, browse index, search into facet values, generateSecuredApiKey, add key, update key

About this parameter

Removes stop (common) words from the query before executing it.

Stop word removal is useful when you have a query in natural language, e.g. “what is a record?”. In that case, the engine will remove “what”, “is”, and “a” before executing the query, and therefore just search for “record”. This will remove false positives caused by stop words, especially when combined with optional words (see optionalWords and removeWordsIfNoResults).


Usage notes:
  • removeStopWords is used in conjunction with the queryLanguages setting.

  • You can send it one of 3 values:

    • true, which enables the stop word functionality, ensuring that stop words are removed from consideration in a search. The languages supported here are either every language (this is the default, see list of languages below), or those set by queryLanguages. See queryLanguages example below.

    • false, which disables stop word functionality, allowing stop words to be taken into account in a search.

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

  • For most use cases, however, it is better not to use this feature, as people tend to search by keywords on search engines (that is, they naturally omit stop words).

  • Prefix logic: Stop words only apply on query words that are not interpreted as prefixes. To control how prefixes are interpreted, check out queryType.

  • List of supported languages with their associated ISO code:

    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

Examples

Set the default Query Languages

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

<?php
$index->setSettings([
  'queryLanguages' => ['es'],
  'removeStopWords' => true
]);
index.set_settings({
  queryLanguages: ['es'],
  removeStopWords: true
})
index.setSettings({
  queryLanguages: ['es'],
  removeStopWords: true
});
index.set_settings({
  'queryLanguages': ['es'],
  'removeStopWords': True
})
index.setSettings([
  "queryLanguages": ["es"],
  "removeStopWords": true
])
index.setSettings(
  new JSONObject()
    .put(
      "queryLanguages",
      new JSONArray()
        .put("es")
    )
    .put("removeStopWords", true)
);
dynamic settings = new JObject();
settings.queryLanguages = new JArray()
                            .put("es")
settings.removeStopWords = true;
index.SetSettings(settings);
index.setSettings(
  new IndexSettings()
    .setQueryLanguages(
      QueryLanguages.of(
        Arrays.asList("es")
      )
    )
    .setRemoveStopWords(RemoveStopWords.of(true))
);
res, err := index.SetSettings(algoliasearch.Map{
  "queryLanguages": []string{
    "es",
  },
  "removeStopWords": true,
})
client.execute {
  changeSettings of "myIndex" `with` IndexSettings(
    queryLanguages = Some(QueryLanguages.list(Seq("es")),
    removeStopWords = Some(RemoveStopWords.`true`)
  )
}

Override Query Languages

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

<?php
$results = $index->search('query', [
  'removeStopWords' => ['ca', 'es']
]);
results = index.search('query', {
  removeStopWords: ['ca', 'es']
})
index.search({
  query: 'query',
  removeStopWords: ['ca', 'es']
}).then(res => {
  // console.log(res);
});
results = index.search('query', {
  'removeStopWords': ['ca', 'es']
})
let query = Query(query: "query")
query.removeStopWords = .selected(["ca", "es"])

index.search(query, completionHandler: { (res, error) in
    print(res)
})
index.search(new Query("query").setRemoveStopWords("ca", "es"));
index.search(
  new Query("")
    .RemoveStopWord(
      new RemoveStopWordsBool { Removed = "ca, es" }
    )
);
index.search(
  new Query("").setRemoveStopWords(removeStopWords.of(Arrays.asList(
    "ca",
    "es"
  )))
);
res, err := index.Search("query", algoliasearch.Map{
  "removeStopWords": []string{
    "ca",
    "es",
  },
})
client.execute {
  search into "myIndex" query Query(
    query = Some("query"),
    removeStopWords = Some(removeStopWords.list(Seq("ca", "es")))
  )
}
Php small white
PHP
Ruby small white
Ruby
Javascript small white
JavaScript
Python small white
Python
Swift small white
iOS
Android small white
Android
Csharp small white
C#
Java small white
Java
Go small white
Go
Scala small white
Scala
Php small white
PHP
Ruby small white
Ruby
Javascript small white
JavaScript
Python small white
Python
Swift small white
iOS
Android small white
Android
Csharp small white
C#
Java small white
Java
Go small white
Go
Scala small white
Scala