Customize stop words
On this page
Stop words are the most common words in a language, such as “the”, “that”, and “it” in English. These words don’t usually provide helpful clues in a search. It’s likely that many records, even unrelated ones, contain them—leading to false positives in the search results.
When searching, many people use only keywords and already remove these words themselves. However, if your users tend to search with these words, or with a natural language syntax, as is common in voice search, it’s a good idea to remove stop words from the search query. This is precisely what the removeStopWords
feature does.
This parameter relies on language-specific stop word dictionaries, which Algolia maintains for around 50 languages. You can view the complete list of supported languages in the removeStopWords
usage notes. You can add, turn off, and delete stop words from them using your Algolia dashboard.
Stop words dictionaries are applied at the application rather than index level. If you want to ignore certain words only when searching certain indices, consider using the optionalWords
feature.
You should use removeStopWords
and other language-specific features in conjunction with the queryLanguages
setting. Refer to the guide on how to set an index’s query language to learn more.
Inspecting stop words
If you want to see which stop words are already included in the default dictionary for a particular language, you can search and filter stop words in the Algolia dashboard. For example, you can filter the dictionary for words that Algolia provided by default, words you added, and you can filter for active and inactive stop words.
- Select the Search product icon on your dashboard.
- Navigate to the Dictionaries page in the left sidebar menu of the dashboard.
- Search for and select the language whose stop words you want to inspect on the screen’s top right. Stop words dictionaries are language-specific.
- Select the Words Ignored dictionary.
- You can search for a specific stop word by typing it into the input bar.
- Using the Filter button, you can filter stop words by Status (Enabled or Disabled) or by Type (provided by Algolia, or words you added yourself).
Disabling and deleting stop words
You may find that a particular stop word is important to your use case and want to disable it from a dictionary.
For example, “down” is a stop word that you would normally remove from searches. If your product catalog includes “down jackets” as well as other (not down) jackets, then this word is a crucial signifier and needs to be included in queries for the most relevant results.
In this case, you need to disable the stop word from taking effect.
- Select the Search product icon on your dashboard.
- Navigate to the Dictionaries page in the left sidebar menu of the dashboard.
- Search for and select the language whose stop words you want to customize on the screen’s top right. Stop words dictionaries are language-specific.
- Select the Words Ignored dictionary.
- Use the input bar to search for a stop word to see if it exists.
- If you added the stop word, you can either delete it entirely by clicking the Remove button with a trash can icon or temporarily disable it using the Disable button.
- If the stop word is provided by Algolia, you can only Disable it, using the Disable button.
- Select Review and Save to save this and any other changes.
You can also delete or disable multiple stop words simultaneously by clicking the respective buttons next to each stop word, then reviewing the changes at once.
Adding custom stop words
You may find that your users are searching with words that don’t signify any essentials differences between results and may not appear in your records at all.
For example, your users could be searching with your brand name, even though they’re already on your site. Since all your records are of this brand, the brand name may not appear anywhere in your records.
In this case, it helps to make the brand name a stop word, as it’s already understood and doesn’t need to be searched for.
- Select the Search product icon on your dashboard.
- Navigate to the Dictionaries page in the left sidebar menu of the dashboard.
- Search for and select the language whose stop words you want to customize on the screen’s top right. Stop words dictionaries are language-specific.
- Select the Words Ignored dictionary.
- Use the input bar to search for a stop word to see if it exists.
- If it doesn’t exist, select the + (Add as a custom stop word) button to add it to your stop words dictionary for this language.
- Select Review and Save at the bottom of the screen to save this and any other changes. After you add a word to a dictionary, it’s active by default.
Creating your own custom stop word dictionary
You may have curated your own list of stop words for your use case. To apply only stop words you provided, you can turn off all Algolia-provided stop words using the Actions button. Then, add your own stop words manually or upload them in bulk.
Even if you want to create a completely custom, language-agnostic dictionary, you still need to select a particular language’s dictionary to customize. Then, be sure to set this language as the queryLanguages
and enable removeStopWords
.
- Select the Search product icon on your dashboard.
- Navigate to the Dictionaries page in the left sidebar menu of the dashboard.
- Search for and select the language whose stop words you want to customize on the screen’s top right. Stop words dictionaries are language-specific.
- Select the Words Ignored dictionary.
- Click the Actions button with the gear icon and select Disable Algolia words.
- Click the Actions button with the gear icon and select Upload your list of words.
- Drop and drag or select a CSV or JSON file with your stop words. See the examples below for the expected format.
Create a custom stop word dictionary in CSV format
1
2
3
4
word, language, state, objectID, type
custom, en, enabled, 1, custom
stop, en, disabled, 2, custom
words, en, enabled, 3, custom
Create a custom stop word dictionary in JSON format
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
[
{
"word": "custom",
"language": "en",
"state": "enabled",
"objectID": 1,
"type": "custom"
},
{
"word": "stop",
"language": "en",
"state": "disabled",
"objectID": 2,
"type": "custom"
},
{
"word": "words",
"language": "en",
"state": "enabled",
"objectID": 3,
"type": "custom"
}
]
Using the Actions button, you can also download all custom stop words from a dictionary, either in CSV or JSON format. You may choose to do this regularly to keep track of which custom stop words you added or enabled at a particular time.