-
-
Notifications
You must be signed in to change notification settings - Fork 63
Open
Description
🐛 Bug Report
Problem Description
The unified_search function fails with a Cypher query error when searching for Project and Task nodes:
Variable d not defined (line 11, column 44 (offset: 275))
" WHEN 'Knowledge' THEN (CASE WHEN d IS NOT NULL THEN d.name ELSE null END)"
Root Cause
In src/services/neo4j/searchService/unifiedSearchLogic.ts:
-
Variable scope issue in returnClause (lines 181-183):
- Variable
dis used for all node types in the CASE statement - But
dis only defined inoptionalMatchesfor Knowledge nodes - This causes Cypher query errors for Project and Task searches
- Variable
-
Missing variable definitions in baseWithVariables (lines 235-240):
- Variables
p,k_proj,dare not properly added tobaseWithVariables - This can cause issues with variable availability in Cypher queries
- Variables
Impact
- Function
unified_searchreturns 0 results for all searches - Critical functionality broken for project and task management
- Affects all MCP clients using Atlas
Expected Behavior
unified_searchshould work for all node types (Project, Task, Knowledge)- No Cypher query errors
- Proper search results returned
Steps to Reproduce
- Start Atlas MCP server
- Try unified_search with any value
- Observe error in logs and 0 results returned
Proposed Solution
Fix the variable scope issues in the Cypher query:
- Fix returnClause:
CASE $label
WHEN '${NodeLabels.Knowledge}' THEN (CASE WHEN d IS NOT NULL THEN d.name ELSE null END)
WHEN '${NodeLabels.Project}' THEN n.taskType
WHEN '${NodeLabels.Task}' THEN n.taskType
ELSE n.taskType
END AS entityType,- Fix baseWithVariables:
let baseWithVariables = ["n"];
if (actualLabel === NodeLabels.Task && assignedToUserIdFilter) {
baseWithVariables.push("assignee");
}
if (actualLabel === NodeLabels.Task) {
baseWithVariables.push("p");
}
if (actualLabel === NodeLabels.Knowledge) {
baseWithVariables.push("k_proj", "d");
}
baseWithVariables = [...new Set(baseWithVariables)];Environment
- Atlas MCP Server version: 2.8.15
- Neo4j version: 5.x
- Node.js version: 18+
Labels
bughigh-priorityunified-searchneo4j
Metadata
Metadata
Assignees
Labels
No labels