Skip to content

Conversation

@YuriZmytrakov
Copy link
Collaborator

Description:
At the moment, the default number of returned items and STAC collections is hardcoded as 10 and can not be changed, except by adding limit query parameter to the URL. This update introduces the STAC_ITEM_LIMIT environment variable, allowing us to customize the default limit for returned items and STAC collections.

PR Checklist:

  • Code is formatted and linted (run pre-commit run --all-files)
  • Tests pass (run make test)
  • Documentation has been updated to reflect changes, if applicable
  • Changes are added to the changelog

Yuri Zmytrakov added 2 commits August 27, 2025 15:03
Add tests to verify the STAC_ITEM_LIMIT environment variable correctly limits returned items in all the following endpoints:
- Collections list (`/collections`)
- Search results (`/search`)
- Collection items (`/collections/{id}/items`)

Ensures the pagination and result limiting behaves as expected in the API.
This commit introduces the STAC_ITEM_LIMIT environment variable to control the maximum number of items
returned by key API endpoints:
- GET /collections - Limits collections returned
- GET /collections/{collection_id}/items - Limits items in a collection
- GET /search - Limits search results
@jonhealy1 jonhealy1 self-requested a review August 28, 2025 04:11
Copy link
Collaborator

@jonhealy1 jonhealy1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super cool

CHANGELOG.md Outdated

### Added

- Added default environment variable `STAC_ITEM_LIMIT` to SFEOS for result limiting of returned items and STAC collections
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi. This will need to be moved to the Unreleased section. It can be included in the next release. Also, can you add a link to the pull request number.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jonhealy1 I have moved the changelog comment from Added to Unreleased and added a reference to the pull request number.

@jamesfisher-geo
Copy link
Collaborator

Looks great

Copy link
Collaborator

@jonhealy1 jonhealy1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@YuriZmytrakov Thank you

@jonhealy1 jonhealy1 merged commit ec928c0 into stac-utils:main Aug 28, 2025
15 checks passed
@YuriZmytrakov
Copy link
Collaborator Author

@YuriZmytrakov Thank you

Thank you for merging @jonhealy1 !

YuriZmytrakov added a commit to YuriZmytrakov/stac-fastapi-elasticsearch-opensearch that referenced this pull request Sep 9, 2025
…er of returned items and STAC collections (stac-utils#419)

**Description:**
At the moment, the default number of returned items and STAC collections
is hardcoded as `10` and can not be changed, except by adding `limit`
query parameter to the URL. This update introduces the `STAC_ITEM_LIMIT`
environment variable, allowing us to customize the default limit for
returned items and STAC collections.

**PR Checklist:**

- [x] Code is formatted and linted (run `pre-commit run --all-files`)
- [x] Tests pass (run `make test`)
- [x] Documentation has been updated to reflect changes, if applicable
- [x] Changes are added to the changelog

---------

Co-authored-by: Yuri Zmytrakov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants