Search Memory
Search Memory enables you to query and retrieve information from your knowledge graphs efficiently and intelligently. Cognee combines multiple search strategies to provide comprehensive and contextual results.
Overview
Once you’ve built your knowledge graphs through the Memory Generation process, you need powerful ways to access and retrieve that information. Cognee provides sophisticated search capabilities that go beyond simple text matching.
Search Types
Semantic Search
Find information based on meaning, not just keywords:
- Vector similarity matching
- Contextual understanding
- Fuzzy matching
- Conceptual relationships
Graph-Based Search
Leverage the relationships in your knowledge graph:
- Path traversal
- Relationship queries
- Node exploration
- Pattern matching
Hybrid Search
Combine multiple search strategies:
- Vector + Graph search
- Multi-hop reasoning
- Context aggregation
- Relevance ranking
Search Features
Context-Aware Results
Get results that understand the broader context:
- Document context
- Relationship context
- User context
- Query context
Multi-Modal Search
Search across different types of content:
- Text documents
- Code repositories
- Structured data
- Metadata
Advanced Capabilities
- Query Refinement: Automatic query expansion and refinement
- Result Ranking: Intelligent scoring and ranking algorithms
- Filter Support: Flexible filtering and faceting
- Aggregations: Result grouping and summarization
Search Implementation
Basic Search
# Simple semantic search
results = await cognee.search(
query_text="What is machine learning?",
search_type="semantic"
)
Advanced Search
# Hybrid search with filters
results = await cognee.search(
query_text="machine learning applications in healthcare",
search_type="hybrid",
filters={
"domain": "healthcare",
"date_range": "last_year"
}
)
Graph Search
# Relationship-based search
results = await cognee.search(
query_text="Find all authors who wrote about AI and worked at tech companies",
search_type="graph",
max_hops=2
)
Integration Points
Search Memory integrates with other cognee components:
- Data to Memory: Searches across ingested and processed data
- Memory Processing: Utilizes processed relationships and metadata
- Vector Store: Enables semantic similarity search
- Graph Store: Powers relationship-based queries
Best Practices
Query Optimization
- Be specific in your queries
- Use appropriate search types
- Consider result limits
- Leverage filters when needed
Performance Tips
- Index important fields
- Use appropriate chunk sizes
- Cache frequent queries
- Monitor search metrics
Next Steps
- Explore Search Types in detail
- Learn about Search Configuration
- Understand Query Optimization
- Try Example Queries
Last updated on