Repository navigation
CQL filter by object attribute in list #435
Replies: 1 comment
|
The What does work is a derived queryable. INSERT INTO pgstac.queryables (name, definition, property_path, property_wrapper)
VALUES (
'ifdo:image-creator-names',
'{"type":"array","items":{"type":"string"}}',
$$jsonb_path_query_array(content, '$.properties."ifdo:image-creators"[*].name')$$,
'to_text_array'
);Then filter on it with plain CQL2: {"op": "a_contains",
"args": [{"property": "ifdo:image-creator-names"}, ["Scientist Name"]]}I tested this on A quick workaround with no schema change is {"op": "like", "args": [{"property": "ifdo:image-creators"}, "%\"name\": \"Scientist Name\"%"]}This depends on Postgres' jsonb text formatting ( If this solves it, please mark it as the answer so others with the same problem can find it. |
Uh oh!
There was an error while loading. Please reload this page.
Does pgstacs implementation of CQL allow for filtering entries based on object attributes in lists?
For example, we have a property "image-creators" which is a list of objects:
In this case is is possible to filter for all items which have a "image-creator" with a certain
name, independently of theuriproperty?This seems to be possible using SQL:
But we run out of ideas on how this would work using CQL. Using the
a_contained_byoperation only yields exact matches with the whole object:{"op":"a_contained_by","args":[[{"name":"Scientist Name"}],{"property":"ifdo:image-creators"}]}All reactions