diff options
| author | Dhravya Shah <[email protected]> | 2025-09-13 22:09:40 -0700 |
|---|---|---|
| committer | Dhravya Shah <[email protected]> | 2025-09-13 22:09:40 -0700 |
| commit | 90fd19f2156e28845d9288ea8ffc2d7d9573b77a (patch) | |
| tree | e630e3943d70b688c42a762c11c745159e1d6771 /apps/docs/memory-api/searching | |
| parent | Merge branch 'main' of https://github.com/supermemoryai/supermemory (diff) | |
| download | supermemory-90fd19f2156e28845d9288ea8ffc2d7d9573b77a.tar.xz supermemory-90fd19f2156e28845d9288ea8ffc2d7d9573b77a.zip | |
update: Readme
Diffstat (limited to 'apps/docs/memory-api/searching')
| -rw-r--r-- | apps/docs/memory-api/searching/searching-memories.mdx | 138 |
1 files changed, 0 insertions, 138 deletions
diff --git a/apps/docs/memory-api/searching/searching-memories.mdx b/apps/docs/memory-api/searching/searching-memories.mdx deleted file mode 100644 index a94c0c71..00000000 --- a/apps/docs/memory-api/searching/searching-memories.mdx +++ /dev/null @@ -1,138 +0,0 @@ ---- -title: "Searching Memories" -description: "Learn how to search for and retrieve content from supermemory" ---- - -<Accordion title="Best Practices" defaultOpen icon="sparkles"> -1. **Query Formulation**: - - Use natural language queries - - Include relevant keywords - - Be specific but not too verbose - -2. **Filtering**: - - Use metadata filters for precision - - Combine multiple filters when needed - - Use appropriate thresholds - -3. **Performance**: - - Set appropriate result limits - - Use specific document/chunk filters - - Consider response timing - </Accordion> - -## Basic Search - -To search through your memories, send a POST request to `/search`: - -<CodeGroup> - -```bash cURL -curl https://api.supermemory.ai/v3/search?q=machine+learning+concepts&limit=10 \ - --request GET \ - --header 'Authorization: Bearer SUPERMEMORY_API_KEY' -``` - -```typescript Typescript -await client.search.execute({ - q: "machine learning concepts", - limit: 10, -}); -``` - -```python Python -client.search.execute( - q="machine learning concepts", - limit=10 -) -``` - -</CodeGroup> - -The API will return relevant matches with their similarity scores: - -```json -{ - "results": [ - { - "documentId": "doc_xyz789", - "chunks": [ - { - "content": "Machine learning is a subset of artificial intelligence...", - "isRelevant": true, - "score": 0.85 - } - ], - "score": 0.95, - "metadata": { - "source": "web", - "category": "technology" - }, - "title": "Introduction to Machine Learning" - } - ], - "total": 1, - "timing": 123.45 -} -``` - -## Search Parameters - -```json -{ - "q": "search query", // Required: Search query string - "limit": 10, // Optional: Max results (default: 10) - "documentThreshold": 0.5, // Optional: Min document score (0-1) - "chunkThreshold": 0.5, // Optional: Min chunk score (0-1) - "onlyMatchingChunks": false, // Optional: Skip context chunks - "docId": "doc_id", // Optional: Search in specific doc - "userId": "user_123", // Optional: Search in user's space - "includeSummary": false, // Optional: Include doc summaries - "filters": { - // Optional: Metadata filters - "AND": [ - { - "key": "category", - "value": "technology" - } - ] - }, - "categoriesFilter": [ - // Optional: Category filters - "technology", - "science" - ] -} -``` - -## Search Response - -The search response includes: - -```json -{ - "results": [ - { - "documentId": "string", // Document ID - "chunks": [ - { - // Matching chunks - "content": "string", // Chunk content - "isRelevant": true, // Is directly relevant - "score": 0.95 // Similarity score - } - ], - "score": 0.95, // Document score - "metadata": {}, // Document metadata - "title": "string", // Document title - "createdAt": "string", // Creation date - "updatedAt": "string" // Last update date - } - ], - "total": 1, // Total results - "timing": 123.45 // Search time (ms) -} -``` - -## Next Steps - -Explore more advanced features in our [API Reference](/api-reference/search-memories/search-memories). |