mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-08-15 03:24:19 +00:00
docs: clarify metadata-only PATCH does not reindex (#784)
Updates docs to match the new behavior where metadata-only PATCH updates do not trigger reindexing: - **update-delete-memories/overview.mdx** — Distinguishes content changes (reindex) vs metadata-only (no reindex), adds a note about `accepted`-style updates - **document-operations.mdx** — Clarifies that only content changes trigger reprocessing - **add-memories.mdx** and **add-memories/overview.mdx** — Add notes on metadata-only behavior - **memory-api/ingesting.mdx** — Splits update behavior into content vs metadata-only - **memory-api/creation/adding-memories.mdx** — Adds note for the “Adding Additional Metadata to Files” flow
This commit is contained in:
parent
93bc74883a
commit
6ce7357ffb
7 changed files with 20 additions and 14 deletions
|
|
@ -122,7 +122,7 @@ await client.documents.update("doc_id_123", {
|
|||
});
|
||||
```
|
||||
|
||||
This triggers full reprocessing of the document.
|
||||
This triggers full reprocessing of the document. If you only update metadata (no content change), the document is updated in place with no reindexing.
|
||||
|
||||
### Formatting conversations
|
||||
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ curl -X POST "https://api.supermemory.ai/v3/documents/file" \
|
|||
|
||||
`PATCH /v3/documents/{id}`
|
||||
|
||||
Update existing document content.
|
||||
Update existing document content or metadata. Content changes trigger reindexing; metadata-only updates do not.
|
||||
|
||||
<CodeGroup>
|
||||
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ Get a specific document with its processing status.
|
|||
|
||||
## Update Document
|
||||
|
||||
Update a document's content or metadata. Triggers reprocessing.
|
||||
Update a document's content or metadata. **Content changes** trigger full reprocessing; **metadata-only changes** (e.g. updating `accepted`, `version`) do not reindex.
|
||||
|
||||
<Tabs>
|
||||
<Tab title="TypeScript">
|
||||
|
|
|
|||
|
|
@ -366,9 +366,7 @@ requests.patch(
|
|||
</CodeGroup>
|
||||
|
||||
<Note>
|
||||
The file upload endpoint returns immediately with a memory ID and processing
|
||||
status. The file will be processed asynchronously, and you can check its
|
||||
status using the GET endpoint.
|
||||
Metadata-only PATCH updates the document in place—no reindexing. Use this when adding or changing metadata (e.g. `accepted`, `title`, `description`) without modifying the document content.
|
||||
</Note>
|
||||
|
||||
## Next Steps
|
||||
|
|
|
|||
|
|
@ -612,9 +612,8 @@ curl -X PATCH "https://api.supermemory.ai/v3/documents/abc123" \
|
|||
```
|
||||
|
||||
**Update Behavior**
|
||||
- Old memories are deleted
|
||||
- New memories created from updated content
|
||||
- Same document ID maintained
|
||||
- **Content changes:** Old memories are deleted, new memories created from updated content. Same document ID maintained.
|
||||
- **Metadata-only changes:** Document metadata is updated in place. No reindexing—works with both internal `id` and `customId`.
|
||||
|
||||
### Rate Limits & Quotas
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,10 @@ Choose from direct updates, idempotent upserts, single deletions, and powerful b
|
|||
|
||||
## Direct Updates
|
||||
|
||||
Update existing memories by their ID when you know the specific memory you want to modify. Changes trigger reprocessing through the full pipeline.
|
||||
Update existing memories by their ID when you know the specific memory you want to modify.
|
||||
|
||||
- **Content changes** — Trigger full reprocessing (reindexing) through the pipeline. Response status is `"queued"`.
|
||||
- **Metadata-only changes** — Update the document row only; no reindexing. Response status stays `"done"`. Use this when updating fields like `accepted`, `version`, or other filter metadata without changing the document content.
|
||||
|
||||
<CodeGroup>
|
||||
|
||||
|
|
@ -25,7 +28,7 @@ const updated = await client.documents.update('memory_id_123', {
|
|||
metadata: { version: 2, updated: true }
|
||||
});
|
||||
|
||||
console.log(updated.status); // "queued" for reprocessing
|
||||
console.log(updated.status); // "queued" when content changed; "done" when metadata-only
|
||||
console.log(updated.id); // "memory_id_123"
|
||||
```
|
||||
|
||||
|
|
@ -42,7 +45,7 @@ updated = client.documents.update(
|
|||
metadata={'version': 2, 'updated': True}
|
||||
)
|
||||
|
||||
print(f"Status: {updated.status}") # "queued" for reprocessing
|
||||
print(f"Status: {updated.status}") # "queued" when content changed; "done" when metadata-only
|
||||
print(f"ID: {updated.id}") # "memory_id_123"
|
||||
```
|
||||
|
||||
|
|
@ -58,6 +61,10 @@ curl -X PATCH "https://api.supermemory.ai/v3/documents/memory_id_123" \
|
|||
|
||||
</CodeGroup>
|
||||
|
||||
<Note>
|
||||
**Metadata-only updates:** If you omit `content` or send the same content and only change `metadata` (e.g. `accepted: false` → `accepted: true`), the document is updated in place with no reindexing. Works with both internal `id` and `customId`—no special setup required.
|
||||
</Note>
|
||||
|
||||
## Upserts Using customId
|
||||
|
||||
Use `customId` for idempotent operations where the same `customId` with `add()` will update existing memory instead of creating duplicates.
|
||||
|
|
@ -503,7 +510,7 @@ echo "Total deleted: $TOTAL_DELETED memories"
|
|||
### Update Operations
|
||||
|
||||
1. **Use customId for idempotent updates** - Prevents duplicate memories and enables safe retries
|
||||
2. **Monitor processing status** - Updates trigger full reprocessing pipeline
|
||||
2. **Monitor processing status** - Content changes trigger full reprocessing; metadata-only updates do not reindex
|
||||
3. **Handle metadata carefully** - Updates replace specified metadata keys
|
||||
4. **Implement proper error handling** - Memory may be deleted between operations
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,9 @@ function getDocumentSourceUrl(document: DocumentWithMemories): string {
|
|||
}
|
||||
|
||||
// Extract ID from API URL like docs.googleapis.com/v1/documents/{id}
|
||||
const apiMatch = url.match(/docs\.googleapis\.com\/v1\/documents\/([a-zA-Z0-9_-]+)/)
|
||||
const apiMatch = url.match(
|
||||
/docs\.googleapis\.com\/v1\/documents\/([a-zA-Z0-9_-]+)/,
|
||||
)
|
||||
if (apiMatch?.[1]) {
|
||||
return `${prefix}${apiMatch[1]}/edit`
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue