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

# Search

> Let members find your objects from the slash menu and insert them as references.

> Reintersect apps are in developer preview. Names and limits can still change before general
> release.

A reference kind with a `search` function shows up in the slash menu. When a member types `/` and
your app's slug, Reintersect shows one tab per searchable kind. Each keystroke calls your `search`;
picking a result inserts a reference to its URL, which is then resolved like any pasted link.

```ts theme={null}
export const TaskLink = defineReference("task", {
  title: "Task",
  patterns: { task: "https://tasks.example.com/tasks/:id" },
  resolve: ({ params }) => resolveTask(params.id),
  search: async ({ query, limit, env }) =>
    (await searchTasks(query, limit)).map((task) => ({
      url: `${env.TASKS_URL}/tasks/${task.id}`,
      title: task.title,
      subtitle: task.id,
      status: { state: task.done ? "success" : "queued", label: task.done ? "Done" : "Open" },
    })),
});
```

## Context

| Field | Description |
| - | - |
| `query` | What the member typed. |
| `limit` | How many results to return, 1 to 50. Return at most this many. |
| `actor` | The member searching. |
| `reintersect`, `env`, `config` | As in `resolve`. |

## Results

Return an array of `{ url, title, subtitle?, status? }`:

| Field | Description |
| - | - |
| `url` | An `https://` URL that one of this kind's patterns matches. `reintersect check` warns when a sample result doesn't match. |
| `title` | The result's label. |
| `subtitle` | A secondary line, such as an ID or a project. |
| `status` | `{ state, label }`, shown as in a chip. |

Search is interactive: it shares the 5 second deadline with other interactive calls, so keep it to
one indexed query.

## Search in Cmd+K

`search` serves the slash menu. To make your objects appear in Reintersect's global search (Cmd+K)
without a query to your app, index them ahead of time with the
[search objects API](/search-and-memories).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.