Skip to main content

Search Memory

Search through stored memory entries using various criteria and filters.

Method

Parameters

SearchQuery
required
The search query configuration
string
Text to search for in entry values and metadata
string[]
Filter by specific tags
string[]
Search within specific keys only
string
Regex pattern to match keys
Record<string, any>
Filter by metadata properties
DateRange
Filter by creation date range
number
default:"50"
Maximum number of results to return
number
default:"0"
Number of results to skip (for pagination)
string
default:"timestamp"
Field to sort by: timestamp, key, relevance
string
default:"desc"
Sort order: asc or desc

Response

MemoryEntry[]
Array of matching memory entries
number
Total number of matching entries
boolean
Whether there are more results available
number
Offset for the next page of results
number
Search execution time in milliseconds

Examples

Search Patterns

Search Optimization

Auto-complete

Analytics and Insights

Search Analytics

Error Handling

Best Practices

  1. Use specific tags for better filtering
  2. Implement pagination for large result sets
  3. Cache frequent searches to improve performance
  4. Use debouncing for live search features
  5. Build search indices for complex queries
  6. Monitor search performance and optimize accordingly