Skip to content

Conversation

@jgaucher-cs
Copy link

@jgaucher-cs jgaucher-cs commented Nov 18, 2025

Related Issue(s):

Description:

Hi, when the same item (with the same ID) exists in two collections, the /search endpoint without limit parameter returns the expected result = all items from all collections.

But when we add a limit parameter, the /search endpoint fails: it returns only items from the first collection, with a 'next' link that should allow to get items from the next collections, but this 'next' link doesn't work: it returns nothing. The "previous" link is invalid also.

I have implemented this pytest to demonstrate this: https://github.com/stac-utils/stac-fastapi-pgstac/pull/314/files

It starts by saving 2 items in one or two collections, depending on the use case. Then it calls /search with limit=1

In a nominal use case the log shows:

page: 1
previous url: None
next url: http://test/search?limit=1&token=next%3Atest-collection%3Atest_item2
numberReturned: 1
returned feature: test-collection:test_item2

page: 2
previous url: http://test/search?limit=1&token=prev%3Atest-collection%3Atest-item
next url: None
numberReturned: 1
returned feature: test-collection:test-item
PASSED

In the KO use case:

page: 1
previous url: None
next url: http://test/search?limit=1&token=next%3Atest-collection%3Atest-item # follow this to get to page 2
numberReturned: 1
returned feature: test-collection:test-item

page: 2
previous url: http://test/search?limit=1&token=prev%3A%3A # the previous link is invalid
next url: None
numberReturned: 0 # the page 2 returned no features
FAILED

PR Checklist:

  • pre-commit hooks pass locally
  • Tests pass (run make test)
  • Documentation has been updated to reflect changes, if applicable, and docs build successfully (run make docs)
  • Changes are added to the CHANGELOG.

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.

1 participant