stac-utils / stac-utils/pgstac

missing previous link when `offset>0` but `limit > number_matched`

Open
#338 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PLpgSQL
Stars
223
Forks
57
PR merge metrics
No merged PRs in 30d

Description

In
https://github.com/stac-utils/pgstac/blob/6da165b7c4f6da321d0b58bbb78da2887763a0d8/src/pgstac/sql/004a_collectionsearch.sql#L106

we check if we have needs for previous/next links. I believe there is a case that is missing (ref: https://github.com/stac-utils/stac-fastapi-pgstac/pull/155/files#r1910644543) when you can have less than limit number of collection (e.g n_collections=4 and limit=10) but user may have provided offset=.

Anytime there is an offset>0 I feel we should have a previous link

cc @bitner

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at src/pgstac/sql/004a_collectionsearch.sql around line 106 and compare the link-condition logic with the referenced stac-fastapi-pgstac pull request discussion. Reproduce a search with offset > 0 and fewer matched collections than limit, then verify that the response includes a previous link.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, sql
Domain
databases
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.