Skip to content
Closed
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion graphiti_core/models/nodes/node_db_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,6 @@ def get_community_node_save_query(provider: GraphProvider) -> str:
n.group_id AS group_id,
n.summary AS summary,
n.created_at AS created_at
"""
"""


8 changes: 5 additions & 3 deletions graphiti_core/search/search_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,8 @@ async def edge_bfs_search(
query = (
f"""
UNWIND $bfs_origin_node_uuids AS origin_uuid
MATCH path = (origin:Entity|Episodic {{uuid: origin_uuid}})-[:RELATES_TO|MENTIONS*1..{bfs_max_depth}]->(:Entity)
MATCH path = (origin {{uuid: origin_uuid}})-[:RELATES_TO|MENTIONS*1..{bfs_max_depth}]->(:Entity)
WHERE origin:Entity OR origin:Episodic
UNWIND relationships(path) AS rel
MATCH (n:Entity)-[e:RELATES_TO]-(m:Entity)
WHERE e.uuid = rel.uuid
Expand Down Expand Up @@ -410,8 +411,9 @@ async def node_bfs_search(
query = (
f"""
UNWIND $bfs_origin_node_uuids AS origin_uuid
MATCH (origin:Entity|Episodic {{uuid: origin_uuid}})-[:RELATES_TO|MENTIONS*1..{bfs_max_depth}]->(n:Entity)
WHERE n.group_id = origin.group_id
MATCH (origin {{uuid: origin_uuid}})-[:RELATES_TO|MENTIONS*1..{bfs_max_depth}]->(n:Entity)
WHERE origin:Entity OR origin:Episodic
AND n.group_id = origin.group_id
AND origin.group_id IN $group_ids
"""
+ filter_query
Expand Down
Loading