Skip to main content
The Query Engine is the retrieval module of the GraphRAG library, operating over completed indexes. It provides multiple search methods to answer different types of questions over your knowledge graph.

Search methods

GraphRAG offers four distinct search methods, each optimized for different query patterns:

Local search

Entity-based search combining knowledge graph data with raw text chunks for specific entity questions

Global search

Dataset-wide reasoning using community reports in a map-reduce fashion for holistic questions

DRIFT search

Dynamic search combining global and local approaches with iterative follow-up questions

Basic search

Simple vector RAG over text chunks for comparison with advanced methods
Local search generates answers by combining relevant data from the AI-extracted knowledge graph with text chunks of the raw documents. This method is suitable for questions that require an understanding of specific entities mentioned in the documents.
Example use case: “What are the healing properties of chamomile?”
Local search excels at:
  • Entity-specific questions
  • Questions requiring detailed context about particular items
  • Queries where you know the specific entities involved
Learn more about local search → Global search generates answers by searching over all AI-generated community reports in a map-reduce fashion. This is a resource-intensive method that provides comprehensive responses for questions requiring an understanding of the dataset as a whole.
Example use case: “What are the most significant values of the herbs mentioned in this notebook?”
Global search excels at:
  • Dataset-wide thematic questions
  • Questions requiring aggregation across multiple topics
  • Queries about overall patterns and trends
Learn more about global search → DRIFT Search (Dynamic Reasoning and Inference with Flexible Traversal) introduces a new approach to local search queries by including community information in the search process. It combines characteristics of both global and local search to generate detailed responses while balancing computational costs with quality outcomes.
Key innovation: DRIFT expands the breadth of the query’s starting point and uses community insights to refine a query into detailed follow-up questions.
DRIFT search excels at:
  • Complex questions requiring both broad and detailed context
  • Iterative exploration of topics
  • Questions that benefit from hierarchical reasoning
Learn more about DRIFT search → GraphRAG includes a rudimentary implementation of basic vector RAG to make it easy to compare different search results based on the type of question you are asking. You can specify the top k text unit chunks to include in the summarization context.
Purpose: Baseline comparison with traditional RAG approaches
Learn more about basic search →

Question generation

In addition to search capabilities, GraphRAG provides question generation functionality that takes a list of user queries and generates candidate follow-up questions. This is useful for:
  • Generating follow-up questions in a conversation
  • Creating a list of questions for deeper dataset investigation
  • Guiding exploratory analysis
Learn more about question generation →

Choosing a search method

Use this guide to select the appropriate search method for your use case:

Next steps

Local search guide

Detailed documentation on entity-based search

Global search guide

Learn about dataset-wide reasoning

Configuration

Configure search parameters

API reference

Python API documentation

Build docs developers (and LLMs) love