> For the complete documentation index, see [llms.txt](https://docs.nosto.com/shopware-6/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nosto.com/shopware-6/getting-started/guides/fallback-mechanism-for-search-and-categories.md).

# Fallback mechanism for Search and Categories

### 1 How Nosto Search/Category Merchandising Works

| Phase               | Action                                                                                                                                                                                        |
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Intercept**       | Plugin overrides Shopware’s default routes (`ProductListingRoute`, `ProductSearchRoute`) and sends a request to Nosto.                                                                        |
| **Check response**  | If Nosto returns products, those items render in the storefront.                                                                                                                              |
| **Empty / Timeout** | If Nosto times out, errors, or returns an empty product set, the plugin **automatically falls back** to Shopware’s native route so customers still see default results if they are available. |

***

***

### 2 Timeout Strategy

| Component                                 | Default | Plugin Override                                      |
| ----------------------------------------- | ------- | ---------------------------------------------------- |
| **Nosto PHP SDK** (`SearchRequest`)       | 10 s    | Can be changed at runtime via `setResponseTimeout()` |
| **Nosto Plugin** (`SearchRequestHandler`) | —       | Sets **3s** timeout for every PLP/SERP call          |

*If Nosto does not respond within 3 seconds, the result is treated as empty → fallback is triggered.*

***

### 3 Operational Summary

| Situation                        | Storefront Outcome                                     |
| -------------------------------- | ------------------------------------------------------ |
| **Nosto responds with products** | Nosto results displayed.                               |
| **Nosto returns empty set**      | Shopware default results displayed.                    |
| **Nosto request exceeds 3 s**    | Treated as empty → Shopware default results displayed. |
| **Nosto server error**           | Treated as empty → Shopware default results displayed. |

This logic applies uniformly to **Category Listing** and **Search Result** pages, ensuring uninterrupted shopping even when external services are slow or unavailable.

***


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.nosto.com/shopware-6/getting-started/guides/fallback-mechanism-for-search-and-categories.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
