stac-utils / stac-utils/pgstac
collection filtering on nested properties does not work
Nobody has claimed this yet.
- Dominant language
- PLpgSQL
- Stars
- 223
- Forks
- 57
- PR merge metrics
- No merged PRs in 30d
Description
I know that @bitner is already aware of this but I wanted to write an issue formally for tracking purposes.
When trying to filter on a nested property tenant, I am unable to retrieve the expected collection. For example, given two collections with "tenant" fields set on properties,
id | title | tenant | properties
-------------------------+------------------------------------------------------+------------------+--------------------------------
noaa-emergency-response | NOAA Emergency Response Imagery | test-tenant | {"tenant": "test-tenant"}
barc-thomasfire | Burn Area Reflectance Classification for Thomas Fire | test-fire-tenant | {"tenant": "test-fire-tenant"}
I would expect collection_search to return my collection but it does not find a match:
postgis=# select * from collection_search('{"filter":{"op":"=","args":[{"property":"tenant"},"test-fire-tenant"]}}');
collection_search
---------------------------------------------------------------------------
{"links": [], "collections": [], "numberMatched": 0, "numberReturned": 0}
(1 row)
postgis=# select * from collection_search('{"filter":{"op":"=","args":[{"property":"tenant"},"test-tenant"]}}');
collection_search
---------------------------------------------------------------------------
{"links": [], "collections": [], "numberMatched": 0, "numberReturned": 0}
(1 row)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the two collection_search queries shown in the issue against collections whose tenant value is stored in properties. Trace how collection_search handles the filter's property lookup, then verify that filtering on tenant returns the expected collection and counts instead of an empty result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, sql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100