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

# Search

## Unified search

The `search` query provides full-text search across the entire WikiParfum catalog — perfumes, ingredients, brands, sub-brands, families, and perfumists — in a single call. Results are scored by relevance and grouped by entity type, making it ideal for building search-as-you-type experiences and omnibox interfaces.

## Basic search

<CodeGroup>
  ```graphql Query theme={null}
  query Search {
    search(q: "rose", lang: "EN", limit: 10) {
      q
      totals {
        perfumes
        ingredients
        brands
        families
        perfumists
      }
      results {
        perfumes {
          id
          score
        }
        ingredients {
          id
          score
        }
        brands {
          id
          score
        }
      }
    }
  }
  ```

  ```json Response theme={null}
  {
    "data": {
      "search": {
        "q": "rose",
        "totals": {
          "perfumes": 500,
          "ingredients": 33,
          "brands": 2,
          "families": 0,
          "perfumists": 29
        },
        "results": {
          "perfumes": [
            {
              "id": "382",
              "score": 7.1370167914487554
            },
            {
              "id": "21130",
              "score": 6.500529927578801
            }
          ],
          "ingredients": [
            {
              "id": "606",
              "score": 5.826456673277741
            },
            {
              "id": "1393",
              "score": 4.563734045447043
            }
          ],
          "brands": [
            {
              "id": "926",
              "score": 6.7680567443735145
            },
            {
              "id": "992",
              "score": 6.7680567443735145
            }
          ]
        }
      }
    }
  }
  ```
</CodeGroup>

## Filter by entity type

Use the `types` parameter to restrict results to specific entity types. This reduces payload size and improves response time when you only need one category.

<CodeGroup>
  ```graphql Query theme={null}
  query SearchPerfumesOnly {
    search(q: "sauvage", lang: "EN", types: [perfumes], limit: 20) {
      totals {
        perfumes
      }
      results {
        perfumes {
          id
          score
        }
      }
    }
  }
  ```

  ```json Response theme={null}
  {
    "data": {
      "search": {
        "totals": {
          "perfumes": 31
        },
        "results": {
          "perfumes": [
            {
              "id": "1900",
              "score": 8.798104061328242
            },
            {
              "id": "18951",
              "score": 8.107775023727447
            }
          ]
        }
      }
    }
  }
  ```
</CodeGroup>

### Available search types

| Type          | Description           |
| ------------- | --------------------- |
| `perfumes`    | Fragrance products    |
| `ingredients` | Olfactive ingredients |
| `brands`      | Parent brands         |
| `subbrands`   | Sub-brand lines       |
| `families`    | Olfactive families    |
| `perfumists`  | Fragrance creators    |

## Search multiple types

Combine types to build focused search experiences — for example, searching perfumes and ingredients together for a discovery interface.

<CodeGroup>
  ```graphql Query theme={null}
  query SearchDiscovery {
    search(
      q: "oud"
      lang: "EN"
      types: [perfumes, ingredients]
      limit: 10
    ) {
      totals {
        perfumes
        ingredients
      }
      results {
        perfumes {
          id
          score
        }
        ingredients {
          id
          score
        }
      }
    }
  }
  ```

  ```json Response theme={null}
  {
    "data": {
      "search": {
        "totals": {
          "perfumes": 500,
          "ingredients": 6
        },
        "results": {
          "perfumes": [
            {
              "id": "7186",
              "score": 7.2761666899738495
            },
            {
              "id": "1019",
              "score": 6.585408436407819
            }
          ],
          "ingredients": [
            {
              "id": "1506",
              "score": 6.005822893706604
            },
            {
              "id": "123",
              "score": 6.005822893706604
            }
          ]
        }
      }
    }
  }
  ```
</CodeGroup>

## Catalog-scoped search

Use `limit_catalog: true` to restrict results to perfumes available in the client's configured catalog. This ensures search results only show products the end user can actually access or purchase.

<CodeGroup>
  ```graphql Query theme={null}
  query CatalogSearch {
    search(
      q: "floral"
      lang: "EN"
      types: [perfumes]
      limit: 20
      limit_catalog: true
    ) {
      results {
        perfumes {
          id
          score
        }
      }
    }
  }
  ```

  ```json Response theme={null}
  {
    "data": {
      "search": {
        "results": {
          "perfumes": [
            {
              "id": "8726",
              "score": 8.514574312488504
            },
            {
              "id": "30673",
              "score": 6.204722559640869
            }
          ]
        }
      }
    }
  }
  ```
</CodeGroup>

## Multi-language support

Search works across all supported languages. Pass the appropriate language code to get results matched and ranked in that language.

<CodeGroup>
  ```graphql Query theme={null}
  query SearchInFrench {
    search(q: "boisé", lang: "FR", types: [perfumes, ingredients], limit: 10) {
      results {
        perfumes {
          id
          score
        }
        ingredients {
          id
          score
        }
      }
    }
  }
  ```

  ```json Response theme={null}
  {
    "data": {
      "search": {
        "results": {
          "perfumes": [
            {
              "id": "14772",
              "score": 10.48829872064593
            },
            {
              "id": "14773",
              "score": 10.48829872064593
            }
          ],
          "ingredients": [
            {
              "id": "1358",
              "score": 4.458963073238341
            },
            {
              "id": "958",
              "score": 4.458963073238341
            }
          ]
        }
      }
    }
  }
  ```
</CodeGroup>
