Skip to Content
Core ConceptsSearch Memory

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

Find information based on meaning, not just keywords:

  • Vector similarity matching
  • Contextual understanding
  • Fuzzy matching
  • Conceptual relationships

Leverage the relationships in your knowledge graph:

  • Path traversal
  • Relationship queries
  • Node exploration
  • Pattern matching

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

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

# Simple semantic search results = await cognee.search( query_text="What is machine learning?", search_type="semantic" )
# 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" } )
# 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

Last updated on