Search API
The Search API provides powerful memory retrieval capabilities including semantic search, advanced filtering, and proprietary spreading activation technology for multi-hop reasoning. All search operations are optimized for performance and relevance.Authentication
All search endpoints require authentication with API key:Rate Limits
Basic Semantic Search
Semantic Search (GET)
Perform semantic search with query parameters. Endpoint:GET /search
Query Parameters:
q(string, required): Search queryuser_id(string): Filter by user IDcategory(string): Filter by memory categorytype(string): Filter by memory typelimit(integer, default: 10, max: 50): Number of resultsoffset(integer, default: 0): Offset for paginationthreshold(float, default: 0.7): Similarity threshold (0.0-1.0)include_content(boolean, default: true): Include memory contentinclude_metadata(boolean, default: true): Include metadata
Semantic Search (POST)
Perform semantic search with complex filters and options. Endpoint:POST /search
Request Body:
query(string, required): Search queryfilters(object): Filter criteriauser_id(string or array): User ID(s)category(string or array): Memory category(ies)type(string or array): Memory type(s)created_after(string): Timestamp filtercreated_before(string): Timestamp filtermetadata(object): Metadata key-value pairs
options(object): Search optionslimit(integer): Results per pageoffset(integer): Pagination offsetthreshold(float): Similarity thresholdinclude_content(boolean): Include contentinclude_metadata(boolean): Include metadatasort(string): Sort field (“score”, “created_at”, “updated_at”)order(string): Sort order (“asc”, “desc”)
Advanced Search
Advanced Search
Perform complex searches with multiple filters and ranking options. Endpoint:POST /search/advanced
Request Body:
query(string, required): Search queryfilters(object): Complex filter criteriaranking(object): Ranking configurationsort_by(string): Primary sort fieldorder(string): Sort directionboost_fields(object): Field boost factors
aggregation(object): Aggregation optionsby_category(boolean): Group by categoryby_user(boolean): Group by userby_date(object): Date aggregation settings
Hybrid Search
Combine semantic search with keyword search for better results. Endpoint:POST /search/hybrid
Request Body:
query(string, required): Search querysemantic_weight(float, default: 0.8): Weight for semantic searchkeyword_weight(float, default: 0.2): Weight for keyword searchfilters(object): Filter criteriaoptions(object): Search options
Spreading Activation Search
Enhanced Search with Spreading Activation
Use proprietary spreading activation technology for multi-hop reasoning. Endpoint:GET /search/enhanced
Query Parameters:
q(string, required): Search querymode(string, default: “spreading”, options: “spreading”, “semantic”, “hybrid”): Search modemax_hops(integer, default: 3, max: 5): Maximum propagation hopsdecay_factor(float, default: 0.85): Activation decay per hopthreshold(float, default: 0.1): Activation thresholdbudget(float, default: 1.0): Initial activation budgetinclude_path(boolean, default: false): Include activation paths
Search Analytics
Get Search Statistics
Retrieve search performance and usage statistics. Endpoint:GET /search/stats
Response:
Search Configuration
Get Search Configuration
Retrieve current search configuration settings. Endpoint:GET /search/config
Response:
Update Search Configuration
Update search configuration (admin only). Endpoint:PUT /search/config
Request Body:
Error Handling
Common Error Responses
Error Codes
Best Practices
Search Optimization
- Use Appropriate Thresholds: Adjust similarity threshold based on use case
- Filter Early: Apply filters to reduce search space
- Limit Results: Use reasonable limits to improve performance
- Batch Operations: Use batch search for multiple queries
- Cache Results: Cache frequent search queries
Spreading Activation Tips
- Tune Parameters: Adjust decay_factor and max_hops for your use case
- Monitor Performance: Track spreading activation performance
- Use Budget Wisely: Set appropriate initial budget values
- Include Paths: Enable include_path for debugging and analysis
Hybrid Search Strategy
- Balance Weights: Adjust semantic_weight and keyword_weight based on data
- Combine Strengths: Use semantic for meaning, keyword for exact matches
- Monitor Results: Track performance of each search mode
- Fallback Strategy: Have fallback to basic search if hybrid fails
Performance Metrics
Key Performance Indicators
- Response Time: Target under 200ms for basic search, under 1000ms for spreading activation
- Relevance Score: Target >0.8 average relevance
- Precision: Target >0.9 for top results
- Recall: Target >0.8 for important queries
- Success Rate: Target >99.5%
Monitoring Recommendations
- Track Response Times: Monitor P95 response times
- Monitor Error Rates: Track search failures
- Analyze Query Patterns: Identify popular and failing queries
- Performance Testing: Regular load testing for search endpoints
- Resource Monitoring: Monitor CPU, memory, and network usage