--- title: "Search Parameters" description: "Complete reference for all search parameters and their effects" --- Complete parameter reference for all three search endpoints: document search, memory search, and execute search. ## Common Parameters These parameters work across all search endpoints: **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](/concepts/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 ``` **Search mode - memories only or hybrid search** Controls whether to search only memories or also include document chunks: - **`"memories"`** (default): Searches only memory entries. Returns results with `memory` field. - **`"hybrid"`**: Searches memories first, then falls back to document chunks if needed. Returns mixed results with either `memory` field (for memory results) or `chunk` field (for chunk results). In hybrid mode, results are automatically merged and deduplicated. Results contain objects with either a `memory` key (for memory results) or a `chunk` key (for chunk results from document search). ```typescript searchMode: "memories" // Only search memories (default) searchMode: "hybrid" // Search memories + fallback to chunks ``` **When to use hybrid mode:** - When you want comprehensive search across both memories and documents - When memories might not exist for certain queries but document content is available - When you need the flexibility to get either memory or document chunk results **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 } ```