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

# Search

> Full-text and faceted search across products and sustainability data.

## search

Universal search across all entity types.

```graphql theme={null}
query {
  search(query: "bio-based window") {
    totalCount
    results {
      ... on Product {
        id
        name
        sectorTag
        impactScore { co2Equivalent }
      }
      ... on Supplier {
        id
        name
        country
      }
    }
  }
}
```

**Arguments:**

| Argument | Type    | Required | Description  |
| -------- | ------- | -------- | ------------ |
| `query`  | String! | Yes      | Search query |

## searchProducts

Filtered product search with facets and sorting.

```graphql theme={null}
query {
  searchProducts(input: {
    query: "window frame"
    filters: {
      sectorTag: HIGHTECH_MANUFACTURING
      co2Range: { min: 0, max: 20 }
      certifications: ["ISO14001"]
    }
    sort: { field: CO2_EQUIVALENT, direction: ASC }
    first: 20
  }) {
    totalCount
    edges {
      node {
        id
        name
        sectorTag
        impactScore { co2Equivalent mkiScore }
        certifications
      }
    }
    pageInfo { hasNextPage endCursor }
    facets {
      sectorTag { value count }
      certifications { value count }
      countries { value count }
    }
  }
}
```

**SearchProductsInput:**

| Field     | Type          | Required | Description                                                             |
| --------- | ------------- | -------- | ----------------------------------------------------------------------- |
| `query`   | String        | No       | Full-text search query                                                  |
| `filters` | ProductFilter | No       | Filter criteria (see [Products query](/api-reference/queries/products)) |
| `sort`    | ProductSort   | No       | Sort order                                                              |
| `first`   | Int           | No       | Results to return (default: 20)                                         |
| `after`   | String        | No       | Cursor for pagination                                                   |

## autocomplete

Search-as-you-type suggestions.

```graphql theme={null}
query {
  autocomplete(query: "bio-bas", limit: 5) {
    suggestions {
      text
      type
      id
    }
  }
}
```

**Arguments:**

| Argument | Type    | Required | Description                  |
| -------- | ------- | -------- | ---------------------------- |
| `query`  | String! | Yes      | Partial search text          |
| `limit`  | Int     | No       | Max suggestions (default: 5) |
