-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Bug: Session.run() gets multiple values for query in notebook 05
Summary
Notebook 05 full-text search crashes with:
TypeError: Session.run() got multiple values for argument 'query'
Repro
Run this cell after following the prior notebook setup:
def fulltext_search(driver, index_name, query: str, top_k=5):
"""Perform a full-text search and display results."""
with driver.session() as session:
result = session.run("""
CALL db.index.fulltext.queryNodes($index, $query)
YIELD node, score
RETURN node, score, labels(node) AS labels
LIMIT $limit
""", index=index_name, query=query, limit=top_k)
return list(result)
# Basic search: find chunks mentioning "thermal"
query = "thermal"
print(f'Search: "{query}"')
print("=" * 60)
results = fulltext_search(driver, 'requirement_text', query)
for i, record in enumerate(results):
node = record['node']
text = node.get('text', node.get('name', 'N/A'))
print(f"\n[{i+1}] Score: {record['score']:.4f}")
print(f" {str(text)[:150]}...")Error
TypeError: Session.run() got multiple values for argument 'query'Cause
session.run(, query=...) conflicts with the driver’s run(query, ...) signature (query is the Cypher string parameter name).
Fix
Rename the Cypher parameter and the kwarg (e.g., $q / q=):
def fulltext_search(driver, index_name, query, top_k=5):
"""Perform a full-text search and display results."""
with driver.session() as session:
result = session.run("""
CALL db.index.fulltext.queryNodes($index, $q)
YIELD node, score
RETURN node, score, labels(node) AS labels
LIMIT $limit
""", index=index_name, q=query, limit=top_k)
return list(result)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels