---
title: Search everywhere, by title and by what items say
description: Find anything in Petawork from anywhere, by its title or by the words in its text, see where a person or a company appears in other apps, and link what belongs together.
section: cloud
order: 8
audience: [user, builder, agent]
features: [cloud.api-workspace, cloud.console-search]
sources: [services/nodejs-cloud/lib/refs/content.ts, services/nodejs-cloud/lib/refs/content-pure.ts, services/nodejs-cloud/lib/refs/appears.ts, services/nodejs-cloud/lib/refs/registry.ts, services/nodejs-cloud/lib/refs/http.ts, services/nodejs-cloud/app/api/workspace/refs/mentions/route.ts, services/nodejs-cloud/app/(console)/(shell)/search/page.tsx, services/nodejs-cloud/components/search, services/nodejs-cloud/migrations/0399_workspace_search_content.sql, services/nodejs-cloud/migrations/0400_tasks_comments_search.sql, services/nodejs-cloud/migrations/0401_people_interactions_search.sql, services/nodejs-cloud/migrations/0402_funnel_deals_search.sql, services/nodejs-cloud/migrations/0403_people_companies_search.sql]
---

Petawork's apps keep different things: issues in Tasks, notes in Notes, people and events in People, deals in Funnel.
Search everywhere finds them all from one box, and not only by their titles: a person's name finds the issues, notes,
deals and wrap-ups that mention them, and a phrase finds the notes and comments it appears in.

## Where to search

- **The search page**, `/search`. Type, and every app answers at once. The address holds the query and the kind
  (`/search?q=renewal&kind=deal`), so you can share it or come back to it.
- **⌘K** (Ctrl+K). Title matches come first, as before ([Quick search](/docs/cloud/quick-search.md)). Below them, **Found in text**
  lists items whose text matches, each with the words around the match. The last row, **See all results for …**, opens
  the search page with your query.
- **Each app's own search.** Under the search box in Tasks, Funnel, People and Notes (⌘K in Notes), a line
  **Elsewhere in Petawork · 12 in other apps** appears when other apps have matches for what you typed. It leads to the
  search page.

## What it searches

Every app is searched by title, as in ⌘K. These are also searched by what they say:

| Kind | Searched text | Who sees a match |
|---|---|---|
| Issues | title, description, comments | anyone who can open the issue (never a private team's issue you are not in) |
| Notes | title and body | the vaults you can read |
| People | name, role, company, place, tags and profile; for your own contacts also your notes, how you met, their card, their email addresses and your interactions | anyone who can see the person; private text and interactions only for their owner |
| Companies | name, domain, place, summary, notes | every member |
| Deals | title, notes, source, lost reason, the text of custom fields | the deals Funnel shows you |
| Events | your own wrap-up (how it went, the minutes) and your action items | only you: another member's wrap-up never matches and is never shown |

Each result says where it matched (title, text, comment, notes, interaction, wrap-up, action item) and shows the words
around the match with the match marked. You only ever see what you could open in the app itself, and a snippet is only
ever taken from text you may read.

## How to write a query

| You type | It finds |
|---|---|
| `renewal budget` | items with both words; each word also matches as the start of a longer one (`renew` finds "renewal") |
| `"Ada Lovelace"` | the exact phrase, in that order |
| `launch -draft` | items with "launch" and without "draft" |
| `ada@example.com` | that email address |

A query needs 3 letters or more before text is searched. Shorter ones match titles only, which is what you want while you
are still typing.

Words are matched as written, without stemming, so the search works the same in every language that separates words
with spaces. Issue and note text also matches English word forms ("running" finds "run"). Chinese, Japanese and Korean
text without spaces between words is matched by title only for now.

## The search page

- **Kinds.** Results are grouped by kind (issues, notes, people, …), each with a count. A count with `+` means there are
  more than that. The chips at the top narrow to one kind and show up to 25 per page.
- **Show more** under a kind loads its next page.
- **Keys.** ↓ from the box moves into the results; ↑ ↓, Home and End move between them; Enter opens; `/` goes back to
  the box.
- **Empty box.** It lists what you opened lately (in this browser, the same list as ⌘K).
- Title matches appear first, then matches in text as each app answers. An app that takes too long is named at the bottom;
  search again to include it.

## Appears in {#appears-in}

On a person's page and a company's page, under **Linked**, **Appears in** lists the items of other apps that name them
but are not linked to them yet: issues and comments, notes, deals, your event wrap-ups, and other people's notes. For a
person it looks for their full name and, on your own contact, their email addresses; for a company, its name and its
domain. The match is exact: "Ada Lovelace" does not match "Ada" alone.

**Link** next to an item makes the link (relation "mentions"): the item moves to **Linked**, on both items' pages, and
agents see it in `workspace_link_list`. Items already linked, or mentioned with `@`, are not listed again.

The section loads after the page, so the page never waits for it.

## For agents {#agents}

On the [workspace MCP server](/docs/cloud/workspace-mcp.md):

- `workspace_item_search` with `content: true` adds a **Content matches** section: each kind's hits with where they
  matched and a snippet, the match between `«` and `»`. `offset` pages the content hits (narrow `kinds` to one kind to
  page it). The REST twin is `GET /api/v1/search?query=…&content=true`.
- `workspace_mention_list` `{"ref": "person:…"}` lists where a person or company appears without a link, the same as
  **Appears in**. Make one a link with `workspace_item_link` (`"relation": "mentions"`). It is not in the default tool
  listing: call it by name.

```json
{ "query": "\"Ada Lovelace\" renewal", "content": true, "kinds": ["deal", "issue"] }
```

## The browser API

From a signed-in browser on Petawork Cloud's own site:

- `GET /api/workspace/refs?q=<text>&content=1[&kinds=a,b][&limit=n][&offset=n]` answers
  `{"groups": [{"kind", "hits", "total", "capped", "more", "offset"}], "skipped": []}`. Each hit is the item's card plus
  `field`, `snippet` (`{"text", "marks": [[start, end]]}`, plain text) and `rank`. With `&stream=1` it answers NDJSON: one
  `{"group": …}` line per kind as it answers, then `{"done": true, "skipped": […]}`.
- `GET /api/workspace/refs/mentions?ref=<reference>[&kinds=a,b][&limit=n]` answers `{"item", "names", "groups", "skipped"}`.

## Speed and limits

- Every text search uses a full-text index; none reads a table row by row. The newer ones hold the organisation next
  to the words (migrations 0399 to 0403), so a search reads only your organisation's entries.
- Each app answers on its own, with at most 2 seconds to do it; one query gets at most 1.5 seconds in the database. An
  app that runs over is left out of that answer and named, and the others are shown.
- Each app ranks at most 400 candidate matches per source (an issue's text and its comments are two sources), so a word
  that is in thousands of notes costs the same as a rare one. The count then shows `400+`, and pages go up to 400 deep.
- A snippet is taken from the first 20,000 characters of a text; long texts are indexed up to 20,000 or 50,000
  characters (comments, deal notes and wrap-ups 50,000, interactions and company notes 20,000).
- On a test database with 3,000 rows in each table, each app's search is one index scan of a few milliseconds. In
  practice the page shows title matches in well under half a second and text matches shortly after; the 2-second limit
  per app is the upper bound.
- Answers are kept in your browser for a minute, so going back to a query or between pages does not search again.
  Nothing is sent to an outside service, no AI model is called, and queries are not logged.
