Skip to main content

SearchType

Enum defining the available search modes for cognee.search().
from cognee import SearchType

results = await cognee.search("query", query_type=SearchType.GRAPH_COMPLETION)

Values

ValueDescription
SearchType.SUMMARIESPre-generated hierarchical summaries of content.
SearchType.CHUNKSRaw text segments matching semantically.
SearchType.RAG_COMPLETIONTraditional RAG: retrieve chunks, then LLM answer.
SearchType.TRIPLET_COMPLETIONRetrieve via triplet relationships, then LLM answer.
SearchType.GRAPH_COMPLETIONDefault. Full graph context with LLM completion. (default)
SearchType.GRAPH_COMPLETION_DECOMPOSITIONDecomposes a complex query into focused subqueries, retrieves graph context per subquery, then synthesizes a final answer.
SearchType.GRAPH_SUMMARY_COMPLETIONGraph context with summary-enhanced completion.
SearchType.CYPHERDirect Cypher query against the graph database.
SearchType.NATURAL_LANGUAGENatural language translated to Cypher.
SearchType.GRAPH_COMPLETION_COTGraph completion with chain-of-thought reasoning.
SearchType.GRAPH_COMPLETION_CONTEXT_EXTENSIONGraph completion with extended context window.
SearchType.FEELING_LUCKYAuto-select the best search type for the query.
SearchType.TEMPORALTemporal-aware search for time-sensitive queries.
SearchType.CODING_RULESCode-specific retrieval (coding rules, codebase search).
SearchType.CHUNKS_LEXICALToken-based lexical chunk search (e.g. Jaccard similarity).

Speed vs. accuracy

The biggest cost driver is how many LLM calls a search type makes. Retrieval-only modes return matches without any generation step and are the fastest; single-completion modes add one LLM call; iterative modes make several calls and scale with their round/iteration settings. The table below orders types roughly from fastest to slowest. “Accuracy” here means how well-grounded and complete the answer tends to be — it depends on your data and query, so treat it as a relative guide, not a benchmark.
Search typeLLM callsRelative speedAccuracy / depthBest for
CHUNKS0⚡️ FastestRaw passages, no synthesisDisplay or post-process exact snippets
CHUNKS_LEXICAL0⚡️ FastestKeyword match, no synthesisExact-term / stopword-aware lookups
SUMMARIES0⚡️ FastestPrecomputed summariesShort, high-signal hits
CYPHER0⚡️ FastestExact graph rowsYou know the schema and write the query
RAG_COMPLETION1🟢 FastGood, text-onlySimple chunk-based RAG without graph structure
GRAPH_COMPLETION (default)1🟢 FastHigh — graph-groundedBest balance for most questions
TRIPLET_COMPLETION1🟢 FastHigh — triplet-levelTriplet context (needs TRIPLET_EMBEDDING=true)
NATURAL_LANGUAGE1 query-generation call, retries up to 2 more times on empty/error results🟡 MediumExact graph rowsStructured graph answers without writing Cypher
TEMPORAL1 time-extraction call + answer completion🟡 MediumTime-aware”before/after X”, year ranges, timelines
GRAPH_SUMMARY_COMPLETION2 (summary + answer)🟡 MediumHigh, condensedNoisy/large graphs needing a tighter context
GRAPH_COMPLETION_DECOMPOSITIONseveral (1 split + up to 5 subqueries + synthesis)🟠 SlowerHigher on multi-part questionsMulti-entity / multi-aspect questions
GRAPH_COMPLETION_CONTEXT_EXTENSIONseveral (up to context_extension_rounds, default 4)🔴 SlowestBroader subgraph coverageOpen-ended, exploratory queries
GRAPH_COMPLETION_COTmany (up to max_iter rounds, default 4, several calls each)🔴 SlowestHighest on multi-hop reasoningComplex A → B → C chains
FEELING_LUCKY1 (selection) + chosen typeVariesMatches chosen typeOne-off queries when unsure which to use
To go faster: prefer CHUNKS, SUMMARIES, or CHUNKS_LEXICAL (no LLM call), or pass only_context=True to skip the final completion on any type. To go more accurate: start with GRAPH_COMPLETION, then escalate to GRAPH_COMPLETION_DECOMPOSITION for multi-part questions or GRAPH_COMPLETION_COT for multi-hop reasoning — both trade latency for depth. Lowering max_iter / context_extension_rounds via retriever_specific_config reduces cost for the iterative modes. See Search Basics — Advanced Parameters.

Choosing a Search Type

Use GRAPH_COMPLETION (default) for the best balance of accuracy and context. Use RAG_COMPLETION for a simpler chunk-based approach.
Use CHUNKS for semantic chunk retrieval or CHUNKS_LEXICAL for keyword-based. Use SUMMARIES for pre-generated summaries.
Use CYPHER for raw Cypher queries or NATURAL_LANGUAGE to have cognee translate your question to Cypher.
Use FEELING_LUCKY — cognee will pick the best search type for your query.
All four graph-completion modes retrieve graph triplets and generate an LLM answer, but they differ in depth and latency:
ModeStrategyBest forTrade-off
GRAPH_COMPLETIONSingle-pass retrieval + completionMost queries — good accuracy, low latencyBaseline
GRAPH_COMPLETION_DECOMPOSITIONDecomposes query into 1–5 subqueries, retrieves graph context per subquery, then synthesizes a final answerMulti-entity or multi-aspect questions (e.g. “Tell me about A and B”)One extra LLM call for decomposition; slightly higher latency
GRAPH_SUMMARY_COMPLETIONGraph context condensed via summaries before completionNoisy or large graphs where a tighter context improves coherenceSlightly slower; summary quality matters
GRAPH_COMPLETION_COTIterative: retrieve → answer → validate → follow-up (up to max_iter rounds, default 4)Complex multi-hop questions where stepwise reasoning helpsHigher latency; more LLM calls
GRAPH_COMPLETION_CONTEXT_EXTENSIONIterative: retrieve → generate → use output as new query (up to context_extension_rounds, default 4)Open-ended or exploratory queries needing a broader subgraphHigher latency; early convergence stops extra rounds
See Search Basics — Advanced Parameters and Retrievers for full details.