
How Query Rewriting Works
When you enablerewriteQuery: true
, Supermemory:
- Analyzes your original query for intent and key concepts
- Generates multiple rewrites with different phrasings and synonyms
- Executes searches for both original and rewritten queries in parallel
- Merges and deduplicates results from all queries
- Returns unified results ranked by relevance
- Natural language questions (“How do neural networks learn?”)
- Ambiguous terms that could have multiple meanings
- Complex queries with multiple concepts
- Domain-specific terminology that might have synonyms
Basic Query Rewriting
- TypeScript
- Python
- cURL
Natural Language Questions
Query rewriting excels at converting conversational questions into effective search queries:- TypeScript
- Python
- cURL
Technical Term Expansion
Query rewriting helps find content using different technical terminologies:- TypeScript
- Python
- cURL
Memory Search with Query Rewriting
Query rewriting works with both document and memory search:- TypeScript
- Python
- cURL
Complex Multi-Concept Queries
Query rewriting excels at handling queries with multiple concepts:- TypeScript
- Python
- cURL