# When nothing is found

A search whose named filters match nothing steps back until it finds products, and says what it left out.

"Gelbes Sofa" (yellow sofa) names the sofas and the color yellow, and the shop sells no yellow sofa. Instead of an empty page, the search steps back and shows the sofas:

```sh title="Terminal"
curl -s 'http://127.0.0.1:7800/v1/search?query=gelbes%20Sofa' \
  | jq -c '.relaxed, (.resolution | del(.left_out)), .resolution.left_out,
      [.sections[] | select(.type == "product") | .hits[].entity]'
```

```json title="Answer: 200 · 15 ms · release b25a6aaa"
true
{"category":"wohnen/sofas","filters":{"color":"yellow"},"text":"","complete":true}
[{"where":{"color":"yellow"},"source":"query","label":"Farbe","labels":{"yellow":"Gelb"}}]
["product:SOFA-ASKA-2","product:SOFA-LUND-3","product:SOFA-NIKO-SCHLAF","product:SOFA-VIDAR-ECK"]
```

`relaxed` says the search stepped back. The [resolution](/docs/reference/glossary#resolution) still says what the query named, and `left_out` lists what the results leave out, labeled in the request's locale.

**Reference:** [`relaxed`](/docs/reference/query-api#search.answer.relaxed) · [`left_out`](/docs/reference/query-api#search.answer.resolution.left_out)

## The ladder

A search that named something and found nothing steps down a ladder, one more call to Meilisearch per step, and only while the step before found nothing:

1. Without the filters the query named, within the category it named, searching the words left over.
2. Without the category too, searching the query's words again.

"Rotes Regal Eiche" (red shelf, oak) takes both steps. The [trace](/docs/reference/glossary#trace) has a `relax` step for each, with what it `dropped` and the `text` it searched:

```sh title="Terminal"
curl -s 'http://127.0.0.1:7800/v1/search?query=rotes%20Regal%20Eiche&debug=1' \
  | jq -c '(.trace.steps[] | select(.step == "relax")), [.sections[] | select(.type == "product") | .hits[].entity]'
```

```json title="Answer: 200 · 12 ms · release b25a6aaa"
{"step":"relax","dropped":[{"color":"red"}],"text":"Eiche"}
{"step":"relax","dropped":[{"category":{"within":"wohnen/regale"}}],"text":"rotes Regal Eiche"}
["product:REGAL-STEG"]
```

No shelf is red, and none holds "Eiche", so the second step searches the query's words and finds the Steg bookshelf. A query that named only a category takes the second step at once. A relaxed search never redirects to the page the query named.

**Reference:** [`relax`](/docs/reference/trace#relax)

## Say what was left out

Tell the shopper what the results leave out, from the labels `left_out` carries:

```sh title="Terminal"
curl -s 'http://127.0.0.1:7800/v1/search?query=gelbes%20Sofa' \
  | jq -r '.resolution.left_out[] | "without \(.label) \(.labels[])"'
```

```text title="Answer: 200 · 7.4 ms · release b25a6aaa"
without Farbe Gelb
```

"Farbe Gelb" is color yellow, in the store's German. `ListingPage` from the [React components](/docs/react) says so above the results. Its empty states always offer a next step: `NoResults` offers the way to every product, tips and the shop's departments, and `NoMatches` offers to remove the filters that leave nothing.

**Reference:** [`AppliedFilter`](/docs/reference/query-api#AppliedFilter)

## Nothing at all

A query that names nothing and matches nothing, such as "Fahrrad" (bicycle) in a furniture store, is not an error. It answers empty sections:

```sh title="Terminal"
curl -s 'http://127.0.0.1:7800/v1/search?query=Fahrrad' | jq -c '[.sections[] | {type, total}]'
```

```json title="Answer: 200 · 12 ms · release b25a6aaa"
[{"type":"category","total":0},{"type":"product","total":0},{"type":"content","total":0},{"type":"brand","total":0}]
```

Nothing was named, so nothing is left out and the answer has no `relaxed`.

## Teach the shop the words

The panel's [Insights](/docs/insights) lists the queries that found nothing most often. Such a query is often a word the shop does not know yet:

- A word for something it sells, such as "couch" for a sofa, is a [synonym](/docs/reference/glossary#synonym).
- A phrase with a number, such as "bis 220 cm" (up to 220 cm), is a [pattern](/docs/reference/glossary#pattern).

[Synonyms](/docs/synonyms) and [Patterns](/docs/patterns) show how to add them.

## Next

- [Insights](/docs/insights): the searches that found nothing, day by day.
- [Synonyms](/docs/synonyms): teach the shop the words its shoppers use.
- [React components](/docs/react): the empty states ready to use.
