From d572935e9fe3541520c6e48973910080bd9035cd Mon Sep 17 00:00:00 2001 From: "mintlify[bot]" <109931778+mintlify[bot]@users.noreply.github.com> Date: Fri, 19 Dec 2025 00:08:06 +0000 Subject: [PATCH] Update apps/docs/search/parameters.mdx Co-Authored-By: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com> --- apps/docs/search/parameters.mdx | 512 +++++++++++++++++--------------- 1 file changed, 279 insertions(+), 233 deletions(-) diff --git a/apps/docs/search/parameters.mdx b/apps/docs/search/parameters.mdx index cd1030ae..bd7d8551 100644 --- a/apps/docs/search/parameters.mdx +++ b/apps/docs/search/parameters.mdx @@ -1,242 +1,288 @@ --- -title: "Search Parameters" -description: "Complete reference for all search parameters and their effects" +title: Search parameters +description: Complete reference for all search API parameters --- +## Required parameters -Complete parameter reference for all three search endpoints: document search, memory search, and execute search. - -## Common Parameters - -These parameters work across all search endpoints: +### q - **Search query string** - - The text you want to search for. Can be natural language, keywords, or questions. - - ```typescript - q: "machine learning neural networks" - q: "What are the applications of quantum computing?" - q: "python tutorial beginner" - ``` - - - - **Maximum number of results to return** - - Controls how many results you get back. Higher limits increase response time and size. - - ```typescript - limit: 5 // Fast, focused results - limit: 20 // Comprehensive results - limit: 100 // Maximum recommended - ``` - - - - **Filter by container tags** - - Organizational tags for filtering results. Uses **exact array matching** - must match all tags in the same order. - - ```typescript - containerTags: ["user_123"] // Single tag - containerTags: ["user_123", "project_ai"] // Multiple tags (exact match) - ``` - - - - **Metadata filtering with SQL-like structure** - - JSON string containing AND/OR logic for filtering by metadata fields. Uses the same structure as memory listing filters. - - ```typescript - filters: JSON.stringify({ - AND: [ - { key: "category", value: "tutorial", negate: false }, - { key: "difficulty", value: "beginner", negate: false } - ] - }) - ``` - - - See [Metadata Filtering Guide](/search/filtering) for complete syntax and examples. - - - - - **Re-score results for better relevance** - - Applies a secondary ranking algorithm to improve result quality. Adds ~100-200ms latency but increases accuracy. - - ```typescript - rerank: true // Better accuracy, slower - rerank: false // Faster, standard accuracy - ``` - - - - **Expand and improve the query** - - Rewrites your query to find more relevant results. Particularly useful for abbreviations and domain-specific terms. **Adds ~400ms latency**. - - ```typescript - // Query rewriting examples: - "ML" → "machine learning artificial intelligence" - "JS" → "JavaScript programming language" - "API" → "application programming interface REST" - ``` - - - Query rewriting significantly increases latency. Only use when search quality is more important than speed. - - - -## Document Search Parameters (POST `/v3/search`) - -These parameters are specific to `client.search.documents()`: - - - **Sensitivity for chunk selection** - - Controls which text chunks are included in results: - - **0.0** = Least sensitive (more chunks, more results) - - **1.0** = Most sensitive (fewer chunks, higher quality) - - ```typescript - chunkThreshold: 0.2 // Broad search, many chunks - chunkThreshold: 0.8 // Precise search, only relevant chunks - ``` - - - - **Sensitivity for document selection** - - Controls which documents are considered for search: - - **0.0** = Search more documents (comprehensive) - - **1.0** = Search only highly relevant documents (focused) - - ```typescript - documentThreshold: 0.1 // Cast wide net - documentThreshold: 0.9 // Only very relevant documents - ``` - - - - **Search within a specific document** - - Limit search to chunks within a single document. Useful for finding content in large documents. - - ```typescript - docId: "doc_abc123" // Only search this document - ``` - - - - **Return only exact matching chunks** - - By default, Supermemory includes surrounding chunks for context. Set to `true` to get only the exact matching text. - - ```typescript - onlyMatchingChunks: false // Include context chunks (default) - onlyMatchingChunks: true // Only matching chunks - ``` - - - Context chunks help LLMs understand the full meaning. Only disable if you need precise text extraction. - - - - - **Include complete document content** - - Adds the full document text to each result. Useful for chatbots that need complete context. - - ```typescript - includeFullDocs: true // Full document in response - includeFullDocs: false // Only chunks and metadata - ``` - - - Including full documents can make responses very large. Use sparingly and with appropriate limits. - - - - - **Include document summaries** - - Adds AI-generated document summaries to results. Good middle-ground between chunks and full documents. - - ```typescript - includeSummary: true // Include document summaries - includeSummary: false // No summaries - ``` - - - - **Filter by metadata using SQL queries** - - ```typescript - - // Use this instead: - filters: JSON.stringify({ - OR: [ - { key: "category", value: "technology", negate: false }, - { key: "category", value: "science", negate: false } - ] - }) - ``` - - -## Memory Search Parameters (POST `/v4/search`) - -These parameters are specific to `client.search.memories()`: - - - **Sensitivity for memory selection** - - Controls which memories are returned based on similarity: - - **0.0** = Return more memories (broad search) - - **1.0** = Return only highly similar memories (precise search) - - ```typescript - threshold: 0.3 // Broader memory search - threshold: 0.8 // Only very similar memories - ``` - - - - **Filter by single container tag** - - Note: Memory search uses `containerTag` (singular) while document search uses `containerTags` (plural array). - - ```typescript - containerTag: "user_123" // Single tag for memory search - ``` - - - - **Control what additional data to include** - - Object specifying what contextual information to include with memory results. - - - Include associated documents for each memory - - - - Include parent and child memories (contextual relationships) - - - - Include memory summaries - - - ```typescript - include: { - documents: true, // Show related documents - relatedMemories: true, // Show parent/child memories - summaries: true // Include summaries + The search query string. This is the text you want to search for in your memories and documents. + + ```json + { + "q": "What are John's machine learning preferences?" } ``` + +## Search mode + +### searchMode + + + Controls the search behavior. Available options: + + - `memories` (default): Searches only through memory entries + - `hybrid`: Searches memories first, then falls back to document chunks + + **Hybrid mode behavior:** + - Searches memories and document chunks in parallel + - Merges results by similarity score + - Automatically deduplicates chunks already associated with memories + - Returns the most relevant results from both sources + + ```json + { + "q": "machine learning", + "searchMode": "hybrid" + } + ``` + + +## Result control + +### limit + + + Maximum number of results to return. Must be between 1 and 100. + + ```json + { + "q": "preferences", + "limit": 20 + } + ``` + + +### threshold + + + Minimum similarity score for results (0-1). Higher values return only more relevant results. + + - `0.9-1.0`: Very high similarity (exact matches) + - `0.7-0.9`: High similarity (recommended) + - `0.5-0.7`: Moderate similarity + - `0.0-0.5`: Low similarity (may include irrelevant results) + + ```json + { + "q": "preferences", + "threshold": 0.8 + } + ``` + + +## Query optimization + +### rerank + + + Rerank results using a more sophisticated model for improved relevance. Adds ~200ms latency. + + ```json + { + "q": "preferences", + "rerank": true + } + ``` + + +### rewriteQuery + + + Rewrites the query to improve search results. Adds ~400ms latency. + + Useful for: + - Ambiguous queries + - Queries with typos + - Queries that need clarification + + ```json + { + "q": "ml prefs", + "rewriteQuery": true + } + ``` + + +## Filtering + +### filters + + + Filter results by metadata conditions. Supports complex boolean logic. + + ```json + { + "q": "preferences", + "filters": { + "and": [ + { + "key": "category", + "operator": "equals", + "value": "user_preferences" + }, + { + "key": "priority", + "operator": "greater_than", + "value": 5 + } + ] + } + } + ``` + + See [Filtering](/search/filtering) for detailed documentation. + + +### containerTag + + + Filter results to a specific container tag. Useful for multi-tenant applications. + + ```json + { + "q": "preferences", + "containerTag": "user_123" + } + ``` + + +## Include options + +Control what additional data is included in the response. + +### include.relatedMemories + + + Include memories that are related to the search results through memory relations (updates, extends, derives). + + ```json + { + "q": "preferences", + "include": { + "relatedMemories": true + } + } + ``` + + +### include.forgottenMemories + + + Include memories that have been marked as forgotten. + + ```json + { + "q": "preferences", + "include": { + "forgottenMemories": true + } + } + ``` + + +### include.documents + + + Include document metadata (title, type, metadata) associated with memory results. + + ```json + { + "q": "preferences", + "include": { + "documents": true + } + } + ``` + + +### include.summaries + + + Include document summaries. Requires `include.documents` to be true. + + ```json + { + "q": "preferences", + "include": { + "documents": true, + "summaries": true + } + } + ``` + + +### include.chunks + + + Include the top 5 most relevant document chunks for each memory result. + + ```json + { + "q": "preferences", + "include": { + "chunks": true + } + } + ``` + + +### include.temporalContext + + + Include memories created before and/or after each result. + + ```json + { + "q": "preferences", + "include": { + "temporalContext": { + "before": 3, + "after": 3 + } + } + } + ``` + + +## Complete example + +```json +{ + "q": "What are John's machine learning preferences?", + "searchMode": "hybrid", + "limit": 10, + "threshold": 0.75, + "rerank": true, + "rewriteQuery": false, + "containerTag": "user_john", + "filters": { + "and": [ + { + "key": "category", + "operator": "equals", + "value": "preferences" + }, + { + "key": "confidence", + "operator": "greater_than", + "value": 0.8 + } + ] + }, + "include": { + "relatedMemories": true, + "forgottenMemories": false, + "documents": true, + "summaries": true, + "chunks": true, + "temporalContext": { + "before": 2, + "after": 2 + } + } +} +```