Refactor ORDER BY clauses in edges and nodes to use created_at instead of uuid for better chronological sorting (#322)

* Refactor ORDER BY clauses in edges and nodes to use created_at instead of uuid for better chronological sorting

* Update ORDER BY clauses in edges and nodes to include uuid for improved sorting consistency
This commit is contained in:
Pavlo Paliychuk 2025-04-08 14:48:36 -04:00 committed by GitHub
parent 6b12896723
commit 65b5eeae88
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 6 deletions

View file

@ -161,7 +161,7 @@ class EpisodicEdge(Edge):
n.uuid AS source_node_uuid,
m.uuid AS target_node_uuid,
e.created_at AS created_at
ORDER BY e.uuid DESC
ORDER BY e.created_at, e.uuid DESC
"""
+ limit_query,
group_ids=group_ids,
@ -322,7 +322,7 @@ class EntityEdge(Edge):
e.expired_at AS expired_at,
e.valid_at AS valid_at,
e.invalid_at AS invalid_at
ORDER BY e.uuid DESC
ORDER BY e.created_at, e.uuid DESC
"""
+ limit_query,
group_ids=group_ids,
@ -448,7 +448,7 @@ class CommunityEdge(Edge):
n.uuid AS source_node_uuid,
m.uuid AS target_node_uuid,
e.created_at AS created_at
ORDER BY e.uuid DESC
ORDER BY e.created_at, e.uuid DESC
"""
+ limit_query,
group_ids=group_ids,

View file

@ -237,7 +237,7 @@ class EpisodicNode(Node):
e.source_description AS source_description,
e.source AS source,
e.entity_edges AS entity_edges
ORDER BY e.uuid DESC
ORDER BY e.created_at, e.uuid DESC
"""
+ limit_query,
group_ids=group_ids,
@ -368,7 +368,7 @@ class EntityNode(Node):
n.summary AS summary,
labels(n) AS labels,
properties(n) AS attributes
ORDER BY n.uuid DESC
ORDER BY n.created_at DESC
"""
+ limit_query,
group_ids=group_ids,
@ -483,7 +483,7 @@ class CommunityNode(Node):
n.group_id AS group_id,
n.created_at AS created_at,
n.summary AS summary
ORDER BY n.uuid DESC
ORDER BY n.created_at DESC
"""
+ limit_query,
group_ids=group_ids,