Skip to content
Open
Changes from all 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
10 changes: 8 additions & 2 deletions dp3/api/routers/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,14 @@ async def get_entity_type_eids(

# Apply sorting if specified
if sort_criteria:
# Prepare sort specification with 'last.' prefix for snapshot data
sort_spec = [("last." + attr, direction) for attr, direction in sort_criteria]
# 'eid' uses snapshot _id storage order so standalone EID sorts can use
# the _id index. This intentionally differs from natural EID order for
# some strings (bucket suffixes) and signed integers (binary encoding).
# Other attributes live under 'last.'
sort_spec = [
("_id" if attr == "eid" else "last." + attr, direction)
for attr, direction in sort_criteria
]
cursor = cursor.sort(sort_spec)

cursor_page = cursor.skip(skip).limit(limit)
Expand Down
Loading