Overview
While GraphRAG’s local, global, and DRIFT search methods leverage the knowledge graph structure, basic search implements a straightforward vector similarity search over raw text chunks. This allows you to compare different search results based on the type of question you’re asking.Purpose: Basic search serves as a baseline to demonstrate the advantages of graph-based retrieval methods. It helps you understand when traditional RAG is sufficient and when GraphRAG’s advanced methods provide significant value.
How it works
Basic search operates through a simple retrieval process:Vector similarity search
- Query embedding: The user query is embedded using the same embedding model used for text units
- Similarity search: Text units are ranked by semantic similarity to the query embedding
- Top-k selection: The top
kmost similar text units are selected - Context assembly: Selected text units are concatenated to form the context
Response generation
- Prompt construction: A prompt is constructed with the retrieved text units as context
- LLM generation: The LLM generates a response based on the context and query
Configuration
TheBasicSearch class accepts the following key parameters:
Language model chat completion object for response generation
Context builder for preparing context from text units
Prompt template for generating the search response. Default:
BASIC_SEARCH_SYSTEM_PROMPTFree-form text describing the desired response format
Token encoder for managing token budgets
Additional parameters (e.g., temperature, max_tokens) passed to the LLM call
Additional parameters passed to the context builder. Common parameters:
k: Number of top text units to retrieve (default varies by configuration)max_context_tokens: Maximum tokens for context window
Optional callback functions for event handlers during execution
API usage
Basic usage
Streaming usage
Custom top-k configuration
Performance considerations
Top-k selection
The number of text units retrieved significantly impacts results:Embedding quality
Basic search performance depends heavily on embedding quality:- Embedding model: Use the same model for queries and text units
- Text unit size: Chunk size affects granularity of retrieval
- Semantic coverage: Works best when query terms appear in text units
Limitations
Basic search has several limitations compared to GraphRAG’s advanced methods:When basic search fails
Aggregation questions
Aggregation questions
Question: “What are the top 5 themes in the dataset?”Why it fails: Basic search cannot aggregate information across the entire dataset. It retrieves individual chunks but lacks the global view needed for thematic analysis.Better approach: Use global search
Entity-specific questions
Entity-specific questions
Question: “What is the relationship between Alice and Bob?”Why it struggles: While it might retrieve chunks mentioning both names, it cannot systematically identify and prioritize relationship information.Better approach: Use local search
Multi-hop reasoning
Multi-hop reasoning
Question: “How do collaborations between departments influence innovation?”Why it struggles: Cannot follow connections through the knowledge graph to build comprehensive context.Better approach: Use DRIFT search
Comparison with GraphRAG methods
| Aspect | Basic Search | Local Search | Global Search | DRIFT Search |
|---|---|---|---|---|
| Retrieval | Vector similarity | Entity + graph | Community reports | Hybrid iterative |
| Structure | None | Knowledge graph | Community hierarchy | Graph + hierarchy |
| Context | Text chunks | Entities + relationships + chunks | All community reports | Dynamic multi-level |
| Aggregation | Poor | Moderate | Excellent | Excellent |
| Entity reasoning | No | Yes | Limited | Yes |
| Cost | Lowest | Low-Medium | High | Medium-High |
| Speed | Fastest | Fast | Slow | Medium |
Best practices
Optimize text unit size
Ensure text units are appropriately sized during indexing (typically 300-500 tokens)
Monitor context relevance
Check the retrieved text units to ensure they’re actually relevant to the query
Examples
Simple factual query
Comparison with local search
Evaluating search quality
When to use basic search
Basic search is appropriate when:- You need a baseline for comparison
- Your question contains specific keywords likely to appear in text
- You’re doing simple fact lookup
- You want the fastest possible response time
- Your dataset doesn’t have complex entity relationships
- Cost optimization is critical and quality requirements are low
Next steps
Local search
Learn about entity-based graph search
Global search
Understand dataset-wide reasoning
DRIFT search
Explore hybrid iterative search
Query configuration
Configure search parameters