Search Capabilities Overview
The Context Graph provides a unified search layer that combines multiple search strategies -- semantic embedding similarity, structural graph traversal, decision precedent matching, and entity discovery. The SemanticSearchService orchestrates these strategies, routing queries to the appropriate backend and merging results with configurable ranking.
Search Modes
| Mode | Description | Backend |
|---|---|---|
SEMANTIC | Pure embedding similarity search | Vector Store (Pinecone) |
STRUCTURAL | Graph-based relationship search | Graph Store (Dgraph) |
HYBRID | Combined semantic + structural scoring | Hybrid Store |
PRECEDENT | Decision-focused precedent search | Vector Store + BiTemporal Store |
DISCOVERY | Explore related entities outward | Graph Traversal Engine |
Search Scopes
| Scope | Description |
|---|---|
ALL | Search across entities, decisions, and relationships |
ENTITIES | Search entities only |
DECISIONS | Search decisions only |
RELATIONSHIPS | Search relationships only |
Subsections
| Page | Description |
|---|---|
| Semantic Search | Embedding-based similarity search using vector stores |
| Structural Search | Graph-based search using entity relationships and lineage |
| Unified Search | Combined multi-strategy search with ranked results |
| Precedent Search | Finding relevant past decisions for current contexts |
| Discovery Search | Exploring related entities and neighborhoods |
| Graph Traversal | DFS, BFS, path finding, and cycle detection |
Quick Start
from context_graph.services.semantic_search_service import (
SemanticSearchService,
SearchQuery,
SearchMode,
)
service = get_semantic_search_service()
results = await service.search(SearchQuery(
query="Find datasets similar to sales_data",
tenant_id="acme",
mode=SearchMode.HYBRID,
top_k=10,
))