Bug Description
The search system ignores the configured search_methods and always executes all search methods (BM25, cosine similarity, and BFS) regardless of what is specified in the search configuration.
Steps to Reproduce
Provide a minimal code example that reproduces the issue:
bfs_config = SearchConfig(
node_config=NodeSearchConfig(
search_methods=[NodeSearchMethod.bfs],
bfs_max_depth=1,
reranker=NodeReranker.node_distance
),
edge_config=EdgeSearchConfig(
search_methods=[EdgeSearchMethod.bfs],
bfs_max_depth=1,
reranker=EdgeReranker.node_distance
),
limit=10
)
results = await self.graphiti.search_(
query="spare parts",
center_node_uuid=center_node_uuid,
bfs_origin_node_uuids=[center_node_uuid],
config=bfs_config
)
# All three search methods execute despite only BFS being configured
Expected Behavior
Only the search methods specified in config.search_methods should execute. In the example above, only BFS should run since search_methods=[EdgeSearchMethod.bfs].
Actual Behavior
All search methods (BM25 fulltext search, cosine similarity search, and BFS search) always execute regardless of the search_methods configuration. The search configuration is completely ignored.
Environment
- Graphiti Version: 0.18.1
- Python Version: 3.13
- Operating System: macos
- Database Backend: neo4j
- LLM Provider & Model: OpenAI GPT-4.1-mini
Installation Method
Error Messages/Traceback
No explicit errors, but performance impact and unexpected behavior due to running unintended search methods.
Configuration
# Any search configuration with selective search methods fails to work as expected
SearchConfig(
node_config=NodeSearchConfig(
search_methods=[NodeSearchMethod.bfs], # This gets ignored
bfs_max_depth=1,
reranker=NodeReranker.node_distance
),
edge_config=EdgeSearchConfig(
search_methods=[EdgeSearchMethod.bfs], # This gets ignored
bfs_max_depth=1,
reranker=EdgeReranker.node_distance
)
)
Additional Context
- This happens consistently across all search configurations
- Affects both edge_search and node_search functions in
graphiti_core/search/search.py
- The issue is in lines 180-204 (edge_search) and 301-318 (node_search) where all methods are hardcoded in semaphore_gather calls
- Performance impact: unnecessary search methods consume compute resources and time
- Which component: core library
Possible Solution
The edge_search and node_search functions should conditionally build the search tasks list based on config.search_methods instead of hardcoding all three search methods in the semaphore_gather call.
Code Fix
Replace the hardcoded search method calls with conditional logic:
# Instead of always running all methods:
search_results = await semaphore_gather(
edge_fulltext_search(...), # Always runs
edge_similarity_search(...), # Always runs
edge_bfs_search(...), # Always runs
)
# Use conditional execution:
search_tasks = []
if EdgeSearchMethod.bm25 in config.search_methods:
search_tasks.append(edge_fulltext_search(...))
if EdgeSearchMethod.cosine_similarity in config.search_methods:
search_tasks.append(edge_similarity_search(...))
if EdgeSearchMethod.bfs in config.search_methods:
search_tasks.append(edge_bfs_search(...))
search_results = await semaphore_gather(*search_tasks)
Bug Description
The search system ignores the configured
search_methodsand always executes all search methods (BM25, cosine similarity, and BFS) regardless of what is specified in the search configuration.Steps to Reproduce
Provide a minimal code example that reproduces the issue:
Expected Behavior
Only the search methods specified in
config.search_methodsshould execute. In the example above, only BFS should run sincesearch_methods=[EdgeSearchMethod.bfs].Actual Behavior
All search methods (BM25 fulltext search, cosine similarity search, and BFS search) always execute regardless of the
search_methodsconfiguration. The search configuration is completely ignored.Environment
Installation Method
Error Messages/Traceback
No explicit errors, but performance impact and unexpected behavior due to running unintended search methods.
Configuration
Additional Context
graphiti_core/search/search.pyPossible Solution
The
edge_searchandnode_searchfunctions should conditionally build the search tasks list based onconfig.search_methodsinstead of hardcoding all three search methods in thesemaphore_gathercall.Code Fix
Replace the hardcoded search method calls with conditional logic: