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

Add collection search functionality #289

Closed
hrodmn opened this issue Jul 12, 2024 · 2 comments
Closed

Add collection search functionality #289

hrodmn opened this issue Jul 12, 2024 · 2 comments

Comments

@hrodmn
Copy link
Collaborator

hrodmn commented Jul 12, 2024

Collection-level search is an important tool for data discovery that can unblock users who need to know which collection(s) they are interested in before they are ready to do an item-level search.

There is a proposed collection-search extension to support this feature in the STAC API spec. It has been implemented in at least one STAC, and the result is really powerful when paired with a tool like STAC Browser: https://radiantearth.github.io/stac-browser/#/search/external/emc.spacebel.be/?.language=en

For this feature to work well in pgstac it would be important for collection extents to be properly synced with the item extents, which might not always be the case.

Perhaps related to #139, but I think this is a different feature.

@vincentsarago
Copy link
Member

vincentsarago commented Jul 12, 2024

in 0.8.2 we've added collection_search method

CREATE OR REPLACE FUNCTION collection_search(
_search jsonb DEFAULT '{}'::jsonb
) RETURNS jsonb AS $$
DECLARE
out_records jsonb;
number_matched bigint := collection_search_matched(_search);
number_returned bigint;
_limit int := coalesce((_search->>'limit')::float::int, 10);
_offset int := coalesce((_search->>'offset')::float::int, 0);
links jsonb := '[]';
ret jsonb;
base_url text:= concat(rtrim(base_url(_search->'conf'),'/'), '/collections');
prevoffset int;
nextoffset int;
BEGIN

https://github.com/stac-utils/pgstac/blob/main/CHANGELOG.md#v082

but this is not yet used at stac-fastapi level: stac-utils/stac-fastapi#696

@hrodmn
Copy link
Collaborator Author

hrodmn commented Jul 12, 2024

Amazing, thanks for pointing that out @vincentsarago!

@hrodmn hrodmn closed this as completed Jul 12, 2024
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