Search should match labels and custom field values
OpenSearch & filtersRandy Sauers ·
Summary
Global search matches task titles, descriptions, comments, and activities. It does not match label names or custom field values. A task labelled deferred or doc, or a task with a Doc custom field set to PRC-003, is invisible to search unless the same text appears in the title or description.
Motivation
- Labels are first-class task metadata:
deferred,blocked,task,investigation,build,doc, and domain labels. - Custom fields hold structured references: IDs, document IDs, decision refs, effort.
- The current workaround is to duplicate the value in the description (the
**ID:**line exists for this reason). That is a second source of truth and drifts. - The MCP
searchtool inherits the API search, so agents cannot find tasks by label or custom field either.
Proposed changes
- Extend
GET /searchto match label names attached to tasks. - Extend
GET /searchto match custom field values for text-like fields (text, number, date, dropdown, multiselect, boolean). For dropdown and multiselect, match the option label; for date, match the ISO date; for boolean, match true or false. - Include the match source in the result payload (
matchedOn,matchedValue) so the UI can show why a result matched. - Keep the existing relevance order: title, then description, then label or custom field, then comment or activity.
- The MCP
searchtool returns the same matches without a separate change.
Acceptance criteria
- Searching a label name returns every task that carries that label, even when the label name is not in the title or description.
- Searching a custom field value returns every task with that value, even when the value is not in the title or description.
- Results are permission-scoped to the workspace and project.
- The result payload identifies the match source.
- Existing title, description, comment, and activity search behavior is unchanged.
- The MCP
searchtool returns the same results.
Checked open issues
- #53 advanced filtering, sorting, grouping and saved views (UI filters, not search indexing).
- #33 canonical label identity (label IDs, not search).
- #107 workspace-level shared custom fields (field scope, not search).
- #1986 MCP unable to access custom fields (closed, fixed by #2033; not search).
Additional context
- Current search source:
apps/api/src/search/controllers/global-search.tsmatchestask.title,task.description,project.name,project.description,workspace.name,workspace.description, andactivity.contentortask.title. It never joins the label or custom field tables. - The
SearchResultschema has no label or custom field fields. - The
listTasksendpoint has no label or custom field filter either, so there is no server-side workaround.