@@ -40,6 +40,23 @@ SELECT results_eq($$
40
40
' Test that id gets added to cql filter when cql filter does exist'
41
41
);
42
42
43
+ SELECT results_eq($$
44
+ SELECT add_filters_to_cql(' {"collections":["a","b"]}' ::jsonb);
45
+ $$,$$
46
+ SELECT ' {"filter":{"and": [{"in": [{"property": "collection"}, ["a", "b"]]}]}}' ::jsonb;
47
+ $$,
48
+ ' Test that collections gets added to cql filter when cql filter does not exist'
49
+ );
50
+
51
+ SELECT results_eq($$
52
+ SELECT add_filters_to_cql(' {"collection":["a","b"]}' ::jsonb);
53
+ $$,$$
54
+ SELECT ' {"collection": ["a", "b"]}' ::jsonb;
55
+ $$,
56
+ ' Test that collection are not added to cql filter'
57
+ );
58
+
59
+
43
60
SELECT has_function(' pgstac' ::name, ' cql_and_append' , ARRAY[' jsonb' ,' jsonb' ]);
44
61
45
62
SELECT has_function(' pgstac' ::name, ' query_to_cqlfilter' , ARRAY[' jsonb' ]);
@@ -137,6 +154,22 @@ SELECT results_eq($$
137
154
' Test lt as a filter on a numeric field with order by'
138
155
);
139
156
157
+ SELECT results_eq($$
158
+ select s from search(' {"collections":["pgstac-test-collection"],"fields":{"include":["id"]}, "limit": 1}' ) s;
159
+ $$,$$
160
+ select ' {"next": "20200307aC0870130w361200", "prev": null, "type": "FeatureCollection", "context": {"limit": 1, "matched": 100, "returned": 1}, "features": [{"id": "20200307aC0870130w361200"}]}' ::jsonb
161
+ $$,
162
+ ' Test collections search with unknow collection'
163
+ );
164
+
165
+ SELECT results_eq($$
166
+ select s from search(' {"collections":["something"]}' ) s;
167
+ $$,$$
168
+ select ' {"next": null, "prev": null, "type": "FeatureCollection", "context": {"limit": 10, "matched": 0, "returned": 0}, "features": []}' ::jsonb
169
+ $$,
170
+ ' Test collections search with unknow collection'
171
+ );
172
+
140
173
/* template
141
174
SELECT results_eq($$
142
175
0 commit comments