# EmailSearchResult

The EmailSearchResult type of the TypeScript SDK, which search.query take or answer.

```ts
type EmailSearchResult = {
  ids?: string[]
  limit?: number
  position: number
  results: MessageMeta[]
  scanWindow?: number
  snippets?: EmailSearchSnippet[]
  total?: number
  truncated?: boolean
}
```

## Fields

| Field | Type | Description |
| --- | --- | --- |
| `ids` | `string[]` | Optional. With `fields: "ids"`: the matching message IDs in query order (`results` is then empty) |
| `limit` | `number` | Optional. Effective page size limit applied by the server |
| `position` | `number` | Zero-based index of the first result within total matches |
| `results` | [`MessageMeta[]`](/docs/sdks/typescript/types/message-meta) | List of matching messages for the current page |
| `scanWindow` | `number` | Optional. The cap that clipped: the collapsed results were drawn from the newest this-many matching messages. Present only beside `truncated`, so a client can say "more than N matches" with the N the server applied. |
| `snippets` | [`EmailSearchSnippet[]`](/docs/sdks/typescript/types/email-search-snippet) | Optional. List of search term highlighted snippets for results |
| `total` | `number` | Optional. Total number of matching messages (when calculateTotal was true) |
| `truncated` | `boolean` | Optional. Present (true) only on a collapseThreads query whose scan hit the server's row cap: the collapsed result set covers the newest matches, not all of them, and positional paging ends when that set does even though `total` (when requested) counts the whole match set. Present on EVERY page of such a query, not only the last, so a client can say so from page one. |

## Used by

| Method | What it does |
| --- | --- |
| [`search.query`](/docs/sdks/typescript/search/query) | Structured filter and query messages |
