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

# search - Sorting and filtering

> The search node configures the internal product search and listing pages: filters, sort options, results per page and reusable filter and sort rules.

export const KonfigDeeplink = ({node}) => <>
    You can open this setting directly in the Admin Interface via the following link:{" "}
    <code>{`https://<shop-domain>/admin/config/${node}`}</code>{" "}
    (<a href="/en/admin-interface/konfigurations-deeplinks">Deeplink overview</a>)
  </>;

export const ComingSoon = () => <span style={{
  display: 'inline-block',
  padding: '1px 10px',
  borderRadius: '9999px',
  fontSize: '0.75rem',
  fontWeight: 600,
  letterSpacing: '0.02em',
  backgroundColor: 'rgba(245, 158, 11, 0.18)',
  color: '#D97706',
  border: '1px solid rgba(245, 158, 11, 0.5)',
  verticalAlign: 'middle',
  whiteSpace: 'nowrap'
}}>
    Coming Soon
  </span>;

The `search` node controls the internal product search (not WEBSALE search) and listing pages in the shop. It defines which filters are offered, which sort options are available and how many results are shown per page. It separates the settings for category and search result pages and allows the definition of individual filters and sort rules as reusable building blocks.

***

## `search*` - Basic structure

The basic structure of the `search` node is shown below:

```json theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{
  "search": {
    "categoryNavigation": {},
    "productSearchNavigation": {},
    "productFilter": {},
    "productSortOption": {}
  }
}
```

#### Parameter description

| **Parameter**             | **Description**                                                             |
| ------------------------- | --------------------------------------------------------------------------- |
| `categoryNavigation`      | Controls filters, sorting and results per page on category / listing pages. |
| `productSearchNavigation` | Controls filters, sorting and results per page on search result pages.      |
| `productFilter`           | Defines a filter component.                                                 |
| `productSortOption`       | Defines a sort rule for use in category and search lists.                   |

***

## `search.categoryNavigation` - Filters and sorting for category pages

The `search.categoryNavigation` node controls which filters and sortings are available on category pages, which default sort order applies and the number of results per page.

<KonfigDeeplink node="search.categoryNavigation" />

#### Example configuration

```json theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{
  "defaultResultsPerPage": 16,
  "defaultSortOption": "search.productSortOption.relevance",
  "keepSortSettings": true,
  "productFilters": [
    "search.productFilter.price",
    "search.productFilter.clothingLength",
    "search.productFilter.clothingOuterMaterial",
    "search.productFilter.brand"
  ],
  "resultsPerPageOptions": [16, 24, 32],
  "sortOptions": [
    "search.productSortOption.relevance",
    "search.productSortOption.nameAsc",
    "search.productSortOption.nameDesc",
    "search.productSortOption.priceAsc",
    "search.productSortOption.priceDesc"
  ]
}
```

#### Parameter description

| **Parameter**                          | **Type**    | **Description**                                                                                                                                          |
| -------------------------------------- | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `productFilters`                       | multiAssoc  | List of available filters from `search.productFilter`, for example price, brand or material. The order of the entries matches the order in the frontend. |
| `sortOptions`                          | multiAssoc  | List of sortings the user can choose from `search.productSortOption`, for example relevance, name or price ascending and descending.                     |
| `defaultSortOption`                    | singleAssoc | Preset sorting from `search.productSortOption` when a category page is first loaded, for example by relevance.                                           |
| `resultsPerPageOptions`                | list (uint) | Selectable values for "results per page". <br />The order of the entries matches the order in the frontend.  <br />Default: `[20, 50, 100, 200]`         |
| `defaultResultsPerPage`                | uint        | Default results per page (must also be present in `resultsPerPageOptions`).  <br />Default: `20`                                                         |
| `keepSortSettings`<br /><ComingSoon /> | bool        | Keep the chosen sorting / limit per user session.  <br />Default: `true`                                                                                 |

## `search.productFilter` - Define product filters

The `search.productFilter` node defines individual filters for listing pages, for example brand, material, price or weight. You specify which data field is filtered, how the filter works and whether there are dependencies on other filters.

<KonfigDeeplink node="search.productFilter" />

#### Example configuration (`search.productFilter.weight`)

```json theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{
  "name": "weight",
  "filterDependency": { "filter": null, "options": [] },
  "type": {
    "keyword": { "optionsSort": "numResults", "multiSelect": true },
    "range": null
  },
  "target": {
    "field": "content.customProductField.weight",
    "special": null,
    "attribute": null
  },
  "scoreBoost": 0,
  "optionsDirectlyDisplayable": false,
  "unit": "",
  "numInitialOptions": 0,
  "minOptions": 0
}
```

#### Parameter description

| **Parameter**                                    | **Type**      | **Description**                                                                                                                                                                                                                                                                                                        |
| ------------------------------------------------ | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `name`                                           | string        | Technical name of the filter, for example `brand` or `price`.                                                                                                                                                                                                                                                          |
| `filterDependency`                               | object        | Defines the dependency on another filter.                                                                                                                                                                                                                                                                              |
| `filter`                                         | singleAssoc   | Reference to the dependent filter from `search.productFilter`.                                                                                                                                                                                                                                                         |
| `options`                                        | list (string) | Allowed options of the dependent filter; when these are selected, this filter becomes active.  <br /> Example:   show "Size" filter only if the category "Clothing" is selected:  <br />`{   "name": "size",   "filterDependency": {     "filter": "search.productFilter.category",     "options": ["clothing"]   } }` |
| `type`                                           | oneOf         | Defines how the filter works.                                                                                                                                                                                                                                                                                          |
| `keyword`                                        | object        | Selection list with fixed values, for example brands or colours.                                                                                                                                                                                                                                                       |
| `optionsSort`                                    | enum          | Sort order of the option values.   <br />Possible values:   `lexical` — alphabetical sort.   `numResults` — sort by hit count.   `relevance` — sort by relevance.                                                                                                                                                      |
| `multiSelect`                                    | bool          | Allow multi-selection or only a single option.                                                                                                                                                                                                                                                                         |
| `range`                                          | object        | Controls a numeric filter, for example price or weight.                                                                                                                                                                                                                                                                |
| `inputType`                                      | enum          | Defines how users choose the numeric range of the filter:   <br />`rangeonly` — freely adjustable range.   `optionsOnly` — only predefined steps to select.   `rangeAndOptions` — combines both.                                                                                                                       |
| `optionType`                                     | enum          | Determines where the numeric range steps come from:   <br />`static` — define fixed steps manually.   `dynamic` — steps are calculated automatically from existing product values.                                                                                                                                     |
| `dynamicSteps`                                   | int           | Specifies the number of dynamic steps. <br />(Only used if `optionType` is set to `dynamic`.)                                                                                                                                                                                                                          |
| `statisticOptions`                               | list (object) | List of fixed numeric range steps.                                                                                                                                                                                                                                                                                     |
| `from`                                           | float         | Lower bound of the numeric range step.                                                                                                                                                                                                                                                                                 |
| `to`                                             | float         | Upper bound of the numeric range step.                                                                                                                                                                                                                                                                                 |
| `target`                                         | oneOf         | Defines which product field the filter uses, for example a product field or a product attribute.                                                                                                                                                                                                                       |
| `field`                                          | singleAssoc   | Binds the filter to a product field, for example `content.customProductField.weight`. <br />The data comes from `content.productField` \| `content.customProductField`.                                                                                                                                                |
| `special`                                        | enum          | Determines whether to filter by category ID (`categories`) or new arrivals (`new`).                                                                                                                                                                                                                                    |
| `attribute`                                      | singleAssoc   | Binds the filter to a product attribute. <br />Data from `content.productAttribute`.                                                                                                                                                                                                                                   |
| `scoreBoost`<br /><ComingSoon />                 | float         | Increases the ranking influence of selected filter values on the result order.                                                                                                                                                                                                                                         |
| `optionsDirectlyDisplayable`<br /><ComingSoon /> | bool          | `true` — the option list can be shown in full without "show more".  <br />`false` — the option list can be collapsed.                                                                                                                                                                                                  |
| `unit`                                           | string        | Unit for display, for example `kg`, `cm` or `€`.                                                                                                                                                                                                                                                                       |
| `numInitialOptions`                              | uint          | Number of option values initially visible, for example show 5 first and let the rest be expanded.                                                                                                                                                                                                                      |
| `minOptions`                                     | uint          | Minimum number of option values required for the filter to be displayed at all.                                                                                                                                                                                                                                        |

### Filters on price fields

Price fields can carry time-controlled promotional prices. For filters and sortings, there is a restriction to keep in mind when configuring.

<Warning>
  In the search index, price fields are stored exclusively with their standard price. Scheduled promotional prices are not available in the index and therefore do not affect filters and sortings. A product with an active promotional price is sorted by its standard price, even if the lower promotional price is displayed in the shop.

  The standard field `setPrice` has been removed, as has its corresponding index field. Filters and sortings that point to it must be adjusted. Details are described in the section [The set price is no longer stored](/en/schnittstellen/admin-interface-api/api-referenz-produkte#the-set-price-is-no-longer-stored).
</Warning>

***

## `search.productSearchNavigation` - Filters and sorting for search result pages

The `search.productSearchNavigation` node defines the filters and sorting on search result pages. You can set, for example, the default sort order, the results per page and a limit for the maximum number of results per search.

<KonfigDeeplink node="search.productSearchNavigation" />

#### Example configuration

```json theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{
  "defaultResultsPerPage": 16,
  "defaultSortOption": "search.productSortOption.relevance",
  "maxResults": 1000,
  "productFilters": [
    "search.productFilter.price",
    "search.productFilter.clothingLength",
    "search.productFilter.clothingOuterMaterial",
    "search.productFilter.brand"
  ],
  "resultsPerPageOptions": [16, 24, 32],
  "sortOptions": [
    "search.productSortOption.relevance",
    "search.productSortOption.nameAsc",
    "search.productSortOption.nameDesc",
    "search.productSortOption.priceAsc",
    "search.productSortOption.priceDesc"
  ]
}
```

#### Parameter description

| **Parameter**           | **Type**    | **Description**                                                                                                        |
| ----------------------- | ----------- | ---------------------------------------------------------------------------------------------------------------------- |
| `productFilters`        | multiAssoc  | Available filters for the search, for example price, brand or material. The order matches the display in the frontend. |
| `sortOptions`           | multiAssoc  | Sortings selectable by the user, for example relevance or name and price ascending and descending.                     |
| `defaultSortOption`     | singleAssoc | Preset sorting of the search results, for example relevance.                                                           |
| `resultsPerPageOptions` | list (uint) | Selectable values for "results per page".      <br />Default: \[`20, 50, 100, 200`]                                    |
| `defaultResultsPerPage` | int         | Default results per page (must be contained in `resultsPerPageOptions`).                                               |
| `maxResults`            | int         | Maximum number of results that are considered / displayed for a search.                                                |

***

## `search.productSortOption` - Sort option

The `search.productSortOption` node defines a sort option for category and search result pages. It defines, for example, what is sorted by and in which direction.

<KonfigDeeplink node="search.productSortOption" />

#### Example configuration (`search.productSortOption.relevance`)

```json theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{
  "name": "Beliebtheit",
  "target": {
    "field": null,
    "special": "relevance"
  }
}
```

#### Parameter description

| **Parameter** | **Type** | **Description**                                                                                              |
| ------------- | -------- | ------------------------------------------------------------------------------------------------------------ |
| `name`        | string   | Display name of the sorting in the frontend, for example "Popularity".                                       |
| `target`      | oneOf    | Defines what to sort by. Exactly one variant can be chosen:   <br />`field` or `special`.                    |
| `field`       | object   | Sort by a specific product field.                                                                            |
| `field`       | enum     | Product field from `content.productField` \| `content.customProductField` to sort by, for example the price. |
| `direction`   | enum     | Sort direction.   <br />`asc` = ascending.   <br />`desc` = descending.                                      |
| `special`     | enum     | System sorting by relevance (`relevance`).                                                                   |

<Note>
  Sorting by a price field operates on the standard price. Promotional prices are not considered, see [Filters on price fields](#filters-on-price-fields).
</Note>


## Related topics

- [Configuration deep links](/en/admin-interface/konfigurations-deeplinks.md)
- [Search & search result page](/en/ws-search/integration-in-die-templates-storefront/suche-suchergebnisseite.md)
- [API basics](/en/schnittstellen/admin-interface-api/api-basics.md)
- [WEBSALE | search](/en/ws-search/websale-search.md)
- [Search API](/en/schnittstellen/search-api.md)
