Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

- Added `id` field as secondary sort to sort config to ensure unique pagination tokens. [#421](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/421)
- Added default environment variable `STAC_ITEM_LIMIT` to SFEOS for result limiting of returned items and STAC collections [#419](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/419)

## [v6.2.0] - 2025-08-27
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,14 @@ def populate_sort_shared(sortby: List) -> Optional[Dict[str, Dict[str, str]]]:
This function transforms a list of sort specifications into the format required by
Elasticsearch/OpenSearch for sorting query results. The returned dictionary can be
directly used in search requests.
Always includes 'id' as secondary sort to ensure unique pagination tokens.
"""
if sortby:
return {s.field: {"order": s.direction} for s in sortby}
sort_config = {s.field: {"order": s.direction} for s in sortby}
sort_config.setdefault("id", {"order": "asc"})
return sort_config
else:
return None
return {"id": {"order": "asc"}}


def add_collections_to_body(
Expand Down