docs(api): rename v5 attach to include (#1763)

Renames v5 `attach` to `include`. GET routes take one comma-separated `include` query param (`?include=chunks,memories`); search takes every option in the JSON body, with `include` as an object of booleans. Also fixes the `forgotten` description: it does let forgotten memories come back as primary results. Pairs with supermemoryai/mono#3410.
This commit is contained in:
sohamd22 2026-10-06 16:48:36 +00:00
parent 3b84713097
commit 2feccc99fa
6 changed files with 24 additions and 22 deletions

View file

@ -1,6 +1,6 @@
---
title: "Migrate search to v5"
description: "Upgrade search modes, filters, attachments, defaults, and response readers"
description: "Upgrade search modes, filters, included context, defaults, and response readers"
sidebarTitle: "Search"
---

View file

@ -9,11 +9,11 @@ GET /v3/documents/{id}/chunks
```
```bash v5
GET /ns/{namespace}/document/{id}?attach=chunks&attach=memories
GET /ns/{namespace}/document/{id}?include=chunks,memories
```
</CodeGroup>
Repeat `attach` to include chunks, memories, or both. Omitted attachment keys are absent; requested attachments with no results are empty arrays. Lifecycle fields move under `system`:
Pass `include` as a comma-separated list to return chunks, memories, or both. Keys you omit are absent; requested keys with no results are empty arrays. Lifecycle fields move under `system`:
```json
{"system":{"status":"done","createdAt":"...","updatedAt":"..."}}
@ -66,7 +66,7 @@ See [memory forgetting](./api-v5-memory-forgetting) for the complete dry-run, ap
### Verification
- Assert requested empty attachments are `[]`, while omitted attachments are absent.
- Assert requested empty includes are `[]`, while omitted includes are absent.
- Paginate each resource type until `currentPage >= totalPages`; unselected arrays stay empty.
- Verify chunk rows contain their parent `documentId`.
- Exercise partial document-delete failures and semantic dry runs.

View file

@ -19,7 +19,7 @@ The API base URL and bearer keys do not change. v5 application routes are unvers
Apply [ingestion](./api-v5-document-writes), [updates](./api-v5-document-updates), [content management](./api-v5-document-reads), [search](./api-v5-recall), [profiles](./api-v5-profiles), [forgetting](./api-v5-memory-forgetting), [namespaces](./api-v5-settings), [organization](./api-v5-organization), and [filter](./api-v5-filters) changes independently.
</Step>
<Step title="Update response readers">
Migrate envelopes, attachments, pagination, profile buckets, system fields, and partial-error handling before switching traffic.
Migrate envelopes, includes, pagination, profile buckets, system fields, and partial-error handling before switching traffic.
</Step>
<Step title="Verify legacy and v5 side by side">
Follow the [verification and rollout guide](./api-v5-rollout). Compare identity and behavior—not raw JSON ordering—and set changed defaults explicitly during rollout.

View file

@ -15,7 +15,7 @@ Record each legacy request, v5 request, expected semantic result, and intentiona
### Compare reads and recall
- Document attachments are absent when omitted and empty arrays when requested without results.
- Document includes are absent when omitted and empty arrays when requested without results.
- Unified list responses populate only the selected resource array.
- Search parity uses explicit v4-equivalent mode and threshold before testing v5 defaults.
- Profiles always contain static, dynamic, and bucket sections.

View file

@ -1,4 +1,4 @@
v5 searches one namespace, defaults to hybrid recall, and moves ranking controls into a typed request body.
v5 searches one namespace, defaults to hybrid recall, and takes every option in one typed JSON body. Search has no query-string parameters.
### Request mapping
@ -6,13 +6,13 @@ v5 searches one namespace, defaults to hybrid recall, and moves ranking controls
| --- | --- |
| `containerTag` | `/ns/{namespace}` |
| body `q` | body `query` |
| body `limit` | query `limit` |
| `searchMode: "documents"` | `searchMode=chunks` |
| omitted search mode | `searchMode=hybrid` |
| body `limit` | body `limit` |
| `searchMode: "documents"` | `searchMode: "chunks"` |
| omitted search mode | `searchMode: "hybrid"` |
| `filters` | singular `filter` |
| `include.documents` or `.summaries` | `attach.documents` |
| `include.relatedMemories` | `attach.related` |
| `include.forgottenMemories` | `attach.forgotten` |
| `include.documents` or `.summaries` | `include.documents` |
| `include.relatedMemories` | `include.related` |
| `include.forgottenMemories` | `include.forgotten` |
| `rerank: true` / `aggregate: true` | `rerank: "order"` / `"aggregate"` |
<CodeGroup>
@ -22,8 +22,8 @@ POST /v4/search
```
```bash v5
POST /ns/user_1/search?limit=10&searchMode=memories
{"query":"What did the user decide?","threshold":0.6,"rewriteQuery":false}
POST /ns/user_1/search
{"query":"What did the user decide?","limit":10,"searchMode":"memories","threshold":0.6,"rewriteQuery":false}
```
</CodeGroup>
@ -48,11 +48,13 @@ Set mode and threshold explicitly while comparing versions. After parity testing
Legacy `include.chunks` has no v5 equivalent. Choose `chunks` or `hybrid` instead.
### Attachments and ranking
### Included context and ranking
- `attach.documents` adds the most relevant source document to each result.
- `attach.related` adds parent, child, and sibling memories.
- `attach.forgotten` allows forgotten memories in related context; it does not make them primary results.
`include` is an object of booleans in the body, e.g. `"include": {"documents": true, "related": true}`. Each flag defaults to `false`.
- `include.documents` adds the most relevant source document to each result.
- `include.related` adds parent, child, and sibling memories.
- `include.forgotten` lets forgotten and expired memories appear in results, including as primary results.
- `rerank` accepts `none`, `order`, or `aggregate`; `rewriteQuery` controls retrieval-oriented query rewriting.
### Response mapping
@ -71,5 +73,5 @@ Each primary result contains either `memory`, `chunk`, or both only if the contr
- Compare IDs using explicit v4-equivalent defaults, then test v5 hybrid behavior separately.
- Cover all three modes, thresholds at `0` and `1`, each rerank option, and query rewriting.
- Cover every attachment alone and in combination, including empty attachments.
- Cover every include alone and in combination, including empty results.
- Verify filters, namespace isolation, result limits, and invalid body/query placement.

View file

@ -5,8 +5,8 @@ description: "Recall the most relevant memories and source context"
icon: "book-open"
---
`POST /ns/{namespace}/search` recalls the most useful memories and source chunks for a query. Hybrid search combines both by default; use `searchMode=memories` or `searchMode=chunks` when your experience needs one result type.
`POST /ns/{namespace}/search` recalls the most useful memories and source chunks for a query. Hybrid search combines both by default; set `searchMode` to `memories` or `chunks` when your experience needs one result type.
Tune relevance with threshold, reranking, query rewriting, filters, and related context in the request body. Result controls `limit` and `searchMode` belong in the query string.
Every option goes in the JSON request body: `query`, `searchMode`, `limit`, `threshold`, `filter`, `include`, `rerank`, and `rewriteQuery`.
See [search migration](/migration/api-v5-recall) and [typed filter migration](/migration/api-v5-filters).