Guides / Managing results / Optimize search results / Handling natural languages

Customize Stop Words

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 our removeStopWords feature does.

This parameter relies on language-specific stop word dictionaries, which we maintain for around 50 languages. You can view the complete list of supported languages in the removeStopWords usage notes. While we update these language-specific dictionaries regularly, you can also add, disable, and delete stop words from them using your Algolia dashboard.

We apply stop words dictionaries 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 our guide on how to set an index’s query language to learn more.

Inspecting stop words

You may be curious to see what stop words we’ve already included in a particular language. Using the dashboard, you can search for stop words and filter a dictionary to show only stop words that Algolia provided or only ones you have added. You can also filter the dictionary to see which stop words are currently enabled or disabled.

Using the dashboard

  1. Navigate to the Dictionaries page in the left sidebar menu of the dashboard.
  2. 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.
  3. Select the Words Ignored dictionary.
  4. You can search for a specific stop word by typing it into the input bar.
  5. Using the Filter button, you can also 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 we 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.

Using the dashboard

  1. Navigate to the Dictionaries page in the left sidebar menu of the dashboard.
  2. 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.
  3. Select the Words Ignored dictionary.
  4. Use the input bar to search for a stop word to see if it exists.
  5. If the stop word is one you have added, you can either delete it entirely by clicking the Remove button with a trash can icon or temporarily disable it using the Disable button.
  6. If the stop word is provided by Algolia, you can only Disable it, using the Disable button.
  7. 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 do not 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 are already on your site. Since all of 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.

Using the dashboard

  1. Navigate to the Dictionaries page in the left sidebar menu of the dashboard.
  2. 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.
  3. Select the Words Ignored dictionary.
  4. Use the input bar to search for a stop word to see if it exists.
  5. 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.
  6. Select Review and Save at the bottom of the screen to save this and any other changes. By default, we enable a word once you add it to a dictionary.

Creating your own custom stop word dictionary

You may have curated your own list of stop words for your use case. To take into account only stop words you provided, you can disable 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.

Using the dashboard

  1. Navigate to the Dictionaries page in the left sidebar menu of the dashboard.
  2. 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.
  3. Select the Words Ignored dictionary.
  4. Click the Actions button with the gear icon and select Disable Algolia words.
  5. Click the Actions button with the gear icon and select Upload your list of words.
  6. Drop and drag or select a CSV or JSON file with your stop words. See the examples below for the expected format.

CSV format

1
2
3
4
word, language, disable, objectID, type 
custom, en, false, 1, custom
stop, en, false, 2, custom
words, en, false, 3, custom

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",
    "disable": false,
    "objectID": 1,
    "type": "custom"
  },
    {
    "word": "stop",
    "language": "en",
    "disable": false,
    "objectID": 2,
    "type": "custom"
  },
    {
    "word": "words",
    "language": "en",
    "disable": false,
    "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.

Did you find this page helpful?