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

Search returning null features for searches with no results #45

Closed
lossyrob opened this issue Aug 18, 2021 · 3 comments
Closed

Search returning null features for searches with no results #45

lossyrob opened this issue Aug 18, 2021 · 3 comments

Comments

@lossyrob
Copy link
Member

Upgrading stac-fastapi to pgstac 0.3.2, some tests are failing because search returns look like:

{
  "type": "FeatureCollection",
  "context": {
    "limit": 10,
    "matched": 0,
    "returned": 0
  },
  "features": null
}

Seems as though pgstac is returning null instead of [] for empty searches, at least in some cases.

lossyrob added a commit to stac-utils/stac-fastapi that referenced this issue Aug 18, 2021
@vincentsarago
Copy link
Member

I think this is due to fields

select s from search('{"collections":["something"]}') s;
>>> {"next": null, "prev": null, "type": "FeatureCollection", "context": {"limit": 10, "matched": 0, "returned": 0}, "features": []}

select s from search('{"collections":["something"],"fields":{"include":["id"]}}') s;
>>>  {"next": null, "prev": null, "type": "FeatureCollection", "context": {"limit": 10, "matched": 0, "returned": 0}, "features": null}

@lossyrob could you point out which tests were failing ?

@lossyrob
Copy link
Member Author

These tests:

FAILED clients/test_postgres.py::test_delete_item - TypeError: 'NoneType' object is not iterable
FAILED resources/test_item.py::test_delete_item - TypeError: 'NoneType' object is not iterable
FAILED resources/test_item.py::test_item_search_by_id_no_results_post - TypeError: 'NoneType' ...
FAILED resources/test_item.py::test_item_search_get_query_extension - TypeError: 'NoneType' ob...

moradology pushed a commit to stac-utils/stac-fastapi that referenced this issue Aug 20, 2021
* Add pgstac run and shell commands to Makefile

* Update to pgstac 0.3.2

* Account for null features.

See stac-utils/pgstac#45

* Set the collection features outside loop
@vincentsarago
Copy link
Member

fixed in #46

gadomski pushed a commit to stac-utils/stac-fastapi-pgstac that referenced this issue Mar 22, 2023
* Add pgstac run and shell commands to Makefile

* Update to pgstac 0.3.2

* Account for null features.

See stac-utils/pgstac#45

* Set the collection features outside loop
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