Skip to content

/search with ?limit fails with same item ID in different collections #392

@jgaucher-cs

Description

@jgaucher-cs

Hi, I'm using pgstac from stac-fastapi-pgstac (see: stac-utils/stac-fastapi-pgstac#315).

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

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions