# types.json

The entity types a release searches, and how each is listed, searched and returned.

## `types`

array of objects

The types this release searches. Built-in types are `product`, `service`, `category`, `content` and `brand`; any other code defines a type of the merchant's own.

An entity type: its capabilities, what one result tile represents, and which fields are searched and returned.

- `type` (string · required): The code of an entity type, such as `product`, `category` or a merchant's own `store`.

- `label` (string or map of strings): A plain value, or a map from locale to value such as \{ "de": "Farbe", "en": "Color" \}.

- `capabilities` (array of strings): What the type can do. Built-in types have fixed capabilities and leave this out: `product` has `variants` and `offers`, `service` has `offers`, `category` has `tree`, `content` and `brand` have none.
  
  - `variants`: One level of buyable variations.
  
  - `offers`: Price and availability per channel.
  
  - `tree`: A place in a tree with one parent.

- `listing` (string or object): What one result tile represents. Default: one tile per product.
  
  What one result tile represents: `"product"`, `"variant"`, or one tile per value of an axis, `{ "axis": "color" }`.
  
  - `product`
  
  - `variant`
  
  - `axis` (string): The code of an attribute definition, such as `color` or `seat_height`. The reserved words `any`, `all`, `not`, `category`, `brand`, `price`, `on_sale`, `availability`, `delivery_days` and `rating` cannot be attribute codes.

- `search` (array of strings): The searched fields in priority order: a word found in an earlier field ranks a hit higher. Default: `title`, `keywords`, `description`. Their order goes live as a setting; which fields are searched needs an index run.

- `typos` (object): Whether, and from how many letters on, a word finds what holds it with a typo. Default: on, one typo from 5 letters, two from 9. It goes live as a setting.
  
  How a type's words forgive typos. A typo is a letter added, left out, changed, or two neighbours swapped; one at the first letter counts as two.
  
  - `enabled` (boolean · default: `true`): Off, a word finds only what holds it as written or starts with it. Default: on.
  
  - `one_typo` (integer · default: `5`): The fewest letters a word needs to find with one typo. Default: 5.
  
  - `two_typos` (integer · default: `9`): The fewest letters a word needs to find with two typos; at least `one_typo`. Default: 9.

- `no_typos` (array of strings): Searched attributes whose words are found only as written or by their start, never with a typo, such as part numbers: one character off names another part. Default: derived by every run, the identifier attributes the type searches whose values nearly always belong to one product alone; `[]` exempts none. A change needs an index run, since the engine reads every document again for it.

- `result` (array of strings): The fields a result returns. Default: `title`, `url` and `image`, and for types with offers also `price`, `sale_price`, `currency` and `availability`.

- `details` (array of strings): The attributes a product lookup lists as the product's and its variants' details, in order, such as `["material", "width", "height"]`. Default: every attribute, in the order of `attributes.json`.

## `$schema`

string

The JSON Schema an editor checks this file against; kept as written.

## Example

```json title="tests/fixtures/home/types.json (trimmed)"
{
  "$schema": "../../../contracts/schema/types.json",
  "types": [
    {
      "type": "product",
      "label": { "de": "Produkt", "en": "Product" },
      "search": ["title", "brand"],
      "result": ["title", "url"],
      "details": ["color", "size"]
    },
    {
      "type": "category",
      "label": { "de": "Kategorie", "en": "Category" },
      "search": ["title", "keywords"],
      "result": ["title", "url"]
    }
  ]
}
```

**Guide:** [Types and attributes](/docs/types-and-attributes#types) · [Fields and typos](/docs/fields-and-typos)
