Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

next parameter is missing from response when sortby is used in a query #589

Closed
samsipe opened this issue Aug 28, 2023 · 2 comments
Closed

Comments

@samsipe
Copy link
Contributor

samsipe commented Aug 28, 2023

The next parameter is missing in the links[0].bodyof the response when sortby is used in a query. I thought pystac-client had the bug, but it's clear what's happening when using postman. This causes clients to either loop forever or keep sending the same query for the first page again and again.

Should the fallback here be to use page on the client side, risking duplicate object being ingested while paging?

Related Issues:

#242 (see comments), #332, #354

Ways to reproduce this bug:

  1. Easiest way to reproduce this is using stac-browser

  2. Using cURL

This works, and you get a next token.

--header 'Content-Type: application/json' \
--data '{
    "limit": 1
}'

Response:

{
    "type": "FeatureCollection",
    "stac_version": "1.0.0",
    "stac_extensions": [],
    "context": {
        "limit": 1,
        "matched": 61610747,
        "returned": 1
    },
    "numberMatched": 61610747,
    "numberReturned": 1,
    "features": [
        {
            ...
        }
    ],
    "links": [
        {
            "rel": "next",
            "title": "Next page of Items",
            "method": "POST",
            "type": "application/geo+json",
            "href": "https://earth-search.aws.element84.com/v1/search",
            "merge": false,
            "body": {
                "limit": 1,
                "next": "2023-08-25T23:36:41.463517Z,S1A_IW_GRDH_1SDV_20230825T233627_20230825T233654_050038_060542,sentinel-1-grd"
            }
        },
        {
            "rel": "root",
            "type": "application/json",
            "href": "https://earth-search.aws.element84.com/v1"
        }
    ]
}

And this doesn’t…

curl --location 'https://earth-search.aws.element84.com/v1/search' \
--header 'Content-Type: application/json' \
--data '{
    "sortby": "-id",
    "limit": 1
}'

Response:

{
    "type": "FeatureCollection",
    "stac_version": "1.0.0",
    "stac_extensions": [],
    "context": {
        "limit": 1,
        "matched": 61610832,
        "returned": 1
    },
    "numberMatched": 61610832,
    "numberReturned": 1,
    "features": [
        {
           ...
        }
    ],
    "links": [
        {
            "rel": "next",
            "title": "Next page of Items",
            "method": "POST",
            "type": "application/geo+json",
            "href": "https://earth-search.aws.element84.com/v1/search",
            "merge": false,
            "body": {
                "sortby": [
                    {
                        "field": "id",
                        "direction": "desc"
                    }
                ],
                "limit": 1
            }
        },
        {
            "rel": "root",
            "type": "application/json",
            "href": "https://earth-search.aws.element84.com/v1"
        }
    ]
}

Nothing in the links[0].body

  1. This just hangs and keeps pinging the API for the next href and body (w/o a next page) forever.
stac-client search https://earth-search.aws.element84.com/v1/ -c sentinel-2-l2a --sortby properties.updated

CC: @philvarner, @dmcvicar

@philvarner
Copy link
Collaborator

fix released in 3.5.0, will be deployed to Earth Search next week

@philvarner
Copy link
Collaborator

deployed to Earth Search.

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

No branches or pull requests

2 participants