Skip to content

Commit c9b83de

Browse files
committed
fix handling of empty string open-ended interval
1 parent 7b00142 commit c9b83de

File tree

2 files changed

+5
-4
lines changed
  • stac_fastapi
    • pgstac/stac_fastapi/pgstac
    • sqlalchemy/stac_fastapi/sqlalchemy

2 files changed

+5
-4
lines changed

stac_fastapi/pgstac/stac_fastapi/pgstac/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ async def item_collection(
186186
Called with `GET /collections/{collection_id}/items`
187187
188188
Args:
189-
id: id of the collection.
189+
collection_id: id of the collection.
190190
limit: number of items to return.
191191
token: pagination token.
192192

stac_fastapi/sqlalchemy/stac_fastapi/sqlalchemy/core.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -349,13 +349,14 @@ def post_search(
349349
# Non-interval date ex. "2000-02-02T00:00:00.00Z"
350350
if len(dts) == 1:
351351
query = query.filter(self.item_table.datetime == dts[0])
352-
elif ".." not in search_request.datetime:
352+
# is there a benefit to between instead of >= and <= ?
353+
elif dts[0] not in ["", ".."] and dts[1] not in ["", ".."]:
353354
query = query.filter(self.item_table.datetime.between(*dts))
354355
# All items after the start date
355-
elif dts[0] != "..":
356+
elif dts[0] not in ["", ".."]:
356357
query = query.filter(self.item_table.datetime >= dts[0])
357358
# All items before the end date
358-
elif dts[1] != "..":
359+
elif dts[1] not in ["", ".."]:
359360
query = query.filter(self.item_table.datetime <= dts[1])
360361

361362
# Query fields

0 commit comments

Comments
 (0)