Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/docs/migration/api-v5-recall.mdx
Original file line number Diff line number Diff line change
@@ -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"
---

Expand Down
6 changes: 3 additions & 3 deletions apps/docs/snippets/api-v5-content-management.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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":"..."}}
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/snippets/api-v5-overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/snippets/api-v5-rollout.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
30 changes: 16 additions & 14 deletions apps/docs/snippets/api-v5-search.mdx
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
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

| Legacy | v5 |
| --- | --- |
| `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>
Expand All @@ -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>

Expand All @@ -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
Expand All @@ -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.
4 changes: 2 additions & 2 deletions apps/docs/v5/api-reference/search.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Loading