Skip to main content
The removeWordsIfNoResults parameter Lets Algolia automatically remove one or more words from the query and retry the search if no results are returned. The goal is to avoid empty results by progressively simplifying the query until results are found. Use removeWordsIfNoResults to configure this behavior. For more information, see Remove words to improve results.

Options

none
Doesn’t remove any words from the query. If no results are found, an empty result set is returned. (Default behavior.)
lastWords
Remove words from the end of the query one at a time, until results are found or a maximum of five words have been removed.
firstWords
Remove words from the beginning of the query one at a time, until results are found or a maximum of five words have been removed.
allOptional
Results can match any subset of the words, rather than requiring all of them.

Example

Current API clients

IndexSettings settings = new IndexSettings();
settings.RemoveWordsIfNoResults = "none";
// settings.RemoveWordsIfNoResults = "lastWords";
// settings.RemoveWordsIfNoResults = "firstWords";
// settings.RemoveWordsIfNoResults = "allOptional";

index.SetSettings(settings);
IndexSettings settings = new IndexSettings();
settings.RemoveWordsIfNoResults = "none";
// settings.RemoveWordsIfNoResults = "lastWords";
// settings.RemoveWordsIfNoResults = "firstWords";
// settings.RemoveWordsIfNoResults = "allOptional";

index.SetSettings(settings);
I