> ## Documentation Index
> Fetch the complete documentation index at: https://algolia.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Empty or insufficient results

> Use these strategies and settings to ensure users always see relevant search results.

export const SearchQuery = () => <Tooltip tip="The text users enter into a search box. In the Search API, this corresponds to the query parameter. A search query is often used with filters, facets, and other parameters, but these aren't part of the query text itself.">
    search query
  </Tooltip>;

export const Records = () => <Tooltip tip="A record is a searchable object in an Algolia index. Each record consists of named attributes." cta="Algolia records" href="/doc/guides/sending-and-managing-data/prepare-your-data#algolia-records">
    records
  </Tooltip>;

export const Index = () => <Tooltip tip="An Algolia index is a searchable dataset that consists of records and configuration settings. These settings define how the records are searched and ranked.">
    index
  </Tooltip>;

export const Facet = () => <Tooltip tip="An attribute in your records that lets users filter or group results (for example, by color, brand, or price)." cta="Faceting" href="/doc/guides/managing-results/refine-results/faceting">
    facet
  </Tooltip>;

export const Application = () => <Tooltip tip="An Algolia application is a self-contained environment with its own indices, configuration, and API keys. Applications don't share data or settings with each other.">
    application
  </Tooltip>;

export const AlgoliaSearch = () => <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 80 80" width="20" height="20" className="inline" fill="none" role="presentation" ariaLabel="Algolia Search">
    <circle cx="40" cy="32" r="28" fill="#5468FF"></circle>
    <rect x="30" y="22" width="20" height="20" rx="10" fill="#fff"></rect>
    <path d="M43 63.5 54.5 60l6 17h-12L43 63.5Z" fill="#36395A"></path>
  </svg>;

When users see no results, they may assume your site doesn't offer what they need.
To avoid this, display related results to help guide users toward relevant content.

For example, showing an empty results set could occur when:

* User queries are too specific.
* Users sometimes enter queries that include unrelated product types.
  For example, a <SearchQuery /> like `cutlery for outdoor table and chairs set` mixes furniture and kitchenware.
  Since only a subset of products match *all* those terms, the search often returns no or irrelevant results.
  A more specific query, like `round outdoor table`, focuses on a single product type and is easier for Algolia to match accurately.
* [Poor data](#good-data) can prevent relevant results from showing.

## Show alternatives in the UI

To improve the user experience:

* Show a set of related but less relevant results.
  Use [Query Suggestions](/doc/guides/building-search-ui/ui-and-ux-patterns/query-suggestions/js) to display helpful popular search alternatives if a query doesn't return any results.
* Show a helpful "no results" page, with suggestions for other queries and a selection of meaningful content.

## How to avoid no results

Review your current solution:

* [Rework your content to ensure good data](#good-data)
* [Make sure your basic search and index settings are optimally configured](#basic-configuration)
* [Ensure the referenced attributes are accessible](#attribute-alignment)
* [Use analytics to see which queries return no results](#analytics).

The next step is to use [advanced settings](#advanced-settings-to-increase-results) to return more results.

### Good data

To improve your <Records />:

* Include different phrasings and vocabulary that match how users search.
* Add keywords users might search for.
* Include enough attributes. Avoid records with sparse attributes: exhaustive data improves matching for unpredictable queries.

### Basic configuration

Algolia offers settings that help you ensure relevant results for most queries. The following often have the most impact:

* **Synonyms.**
  A varied vocabulary is essential to return relevant results.
  Users expect search to recognize industry terms and spelling variations.
  For more information, see [Synonyms](/doc/guides/managing-results/optimize-search-results/adding-synonyms).

* **Typo tolerance.**
  Avoid turning off typo tolerance globally since it can reduce your search results because Algolia only returns exact matches.
  Instead, [turn off typo tolerance for specific attributes](/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance#turn-off-typo-tolerance-for-specific-attributes) where precision matters, such as SKU or product codes.

* **Removing stop words.**
  By [removing common words](/doc/api-reference/api-parameters/removeStopWords) like "the", "a", and "it", Algolia needs to match fewer words in a query, thereby increasing the number of results.
  A user may receive no results when searching for "The Invisible Man" because the film's title is "Invisible Man".
  By removing "The" from the query, users can find the movie.

* **Ignoring plurals.**
  This means that singular and plural forms of the same word can match, helping users find more results.
  Without this feature, a query with a singular form ("spy") won't find a record with the plural ("spies").
  For more information, see [`ignorePlurals`](/doc/api-reference/api-parameters/ignorePlurals).

### Attribute alignment

Empty or insufficient results can occur when your attributes don't match your data model.
For example, you may be using [hierarchical category attributes](/doc/guides/managing-results/refine-results/faceting#hierarchical-facets) like the following:

```json JSON icon=braces theme={"system"}
{
  "categories": {
    "lvl0": "Furniture",
    "lvl1": "Outdoor",
    "lvl2": "Tables"
  }
}
```

If your records don't include these attributes,
any search query or <Facet /> that rely on them won't return any results.

To check your attributes:

1. Go to the [Algolia dashboard](https://dashboard.algolia.com/explorer/browse) and select your Algolia <Application />.
2. On the left sidebar, select <AlgoliaSearch /> **Search**.
3. Click **Show more attributes** to expand a record and look for the referenced attribute. For example, `categories`.
4. If the attribute is missing, either [update your dataset](/doc/guides/sending-and-managing-data/prepare-your-data) to include it or adjust your configuration to match available attributes.

### Analytics

Reviewing your [analytics reports](/doc/guides/search-analytics/overview) helps you analyze your incoming queries and think about getting better results.
By looking at your **top 10 queries**, the most popular words and phrases, and perhaps most importantly, **which searches return no results**,
you can make intelligent choices about your content, search, and <Index /> settings.

## Advanced settings to increase results

Algolia offers some settings explicitly designed to resolve insufficient results.

### Remove words when no results are found

<Info>
  This technique only works with multi-word queries.
</Info>

The general idea is that if the initial search query doesn't return any results,
Algolia removes one of the words from the query and reruns the search.
Algolia continues removing words until it finds results or runs out of words to remove.

For more information, see:

* [`removeWordsIfNoResults`](/doc/api-reference/api-parameters/removeWordsIfNoResults)
* [Remove words to improve results](/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/in-depth/why-use-remove-words-if-no-results)

### Match individual words

<Info>
  This technique only works with multi-word queries.
</Info>

By default, Algolia returns matches that contain all a query's words:

```txt theme={"system"}
"big hamster wheel" => "big" AND "hamster" AND "wheel"
```

Every result must contain all three words.

You can change this by allowing Algolia to return matches that contain only one of the words.

```txt theme={"system"}
"big hamster wheel" => "big" OR "hamster" OR "wheel"
```

With this setting, Algolia can return a record that contains only one word from the query, such as `big`, even if it doesn't include `hamster` or `wheel`.

For more information,
see [`optionalWords`](/doc/api-reference/api-parameters/optionalWords).

<Note>
  Changing this behavior will affect ranking.\_
  Records that match all three words will be ranked higher than records with only two,
  and records with two words are higher than records with only one.
  This is due to the [Words ranking criterion](/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria#words-if-applicable).
</Note>

### Create a list of optional words

If you create a list of optional words,
Algolia runs the query with and without the optional words and merges the results.
This "double-querying" increases the number of results.

For example, say you provide online videos.
If users query `action video`, you can make `video` an optional word.
By doing this, you're instructing Algolia to run two separate queries:
`action video` and `action` and then combine them for the ranking.

For more information, see:

* [An example of optional words](/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/in-depth/why-use-remove-words-if-no-results)
* [`optionalWords`](/doc/api-reference/api-parameters/optionalWords)

<Note>
  **Changing this behavior will affect ranking.**
  Records that match with all words present are ranked higher than words without the optional words.
  This is due to the [Words ranking criterion](/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria#words-if-applicable).
</Note>

### Adjust prefix search

Prefix matching is central to Algolia's as-you-type search experience since it enables matching records based on partial words.
For example, Algolia returns records containing `apricot` when a user types `a`, `ap`, `apr`.
Algolia doesn't need to wait for a full-word match before displaying results.

Prefix matching helps prevent insufficient results and can also return more relevant matches.
By default, Algolia uses "prefix last" logic:
only the last word in a query acts as a prefix, while other words must match as complete words.

For example, the query `ja` finds the sentence "Jack and Jill went up the hill".
But `ja wat` won't.
That's because Algolia treats only the last term, `wat`, as a prefix.
`ja` must match a complete word, which it doesn't.

To broaden results, configure Algolia to treat all query terms as prefixes.
`ja wat` finds "Jack and Jill went up the hill" because `ja` matches "Jack",
and Algolia ignores `wat`.

**This doesn't improve relevance.**
Use it if you want some randomness or have a large number of records where relevance matters less.
Image search is one example where near matches can be useful.

For more information, see:

* [Prefix search](/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/prefix-searching)
* [`queryType`](/doc/api-reference/api-parameters/queryType)
