Skip to content

Commit

Permalink
fix handling of empty string open-ended interval
Browse files Browse the repository at this point in the history
  • Loading branch information
philvarner committed Mar 31, 2022
1 parent 7b00142 commit c9b83de
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion stac_fastapi/pgstac/stac_fastapi/pgstac/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ async def item_collection(
Called with `GET /collections/{collection_id}/items`
Args:
id: id of the collection.
collection_id: id of the collection.
limit: number of items to return.
token: pagination token.
Expand Down
7 changes: 4 additions & 3 deletions stac_fastapi/sqlalchemy/stac_fastapi/sqlalchemy/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,13 +349,14 @@ def post_search(
# Non-interval date ex. "2000-02-02T00:00:00.00Z"
if len(dts) == 1:
query = query.filter(self.item_table.datetime == dts[0])
elif ".." not in search_request.datetime:
# is there a benefit to between instead of >= and <= ?
elif dts[0] not in ["", ".."] and dts[1] not in ["", ".."]:
query = query.filter(self.item_table.datetime.between(*dts))
# All items after the start date
elif dts[0] != "..":
elif dts[0] not in ["", ".."]:
query = query.filter(self.item_table.datetime >= dts[0])
# All items before the end date
elif dts[1] != "..":
elif dts[1] not in ["", ".."]:
query = query.filter(self.item_table.datetime <= dts[1])

# Query fields
Expand Down

0 comments on commit c9b83de

Please sign in to comment.