Skip to content

Commit 9268b46

Browse files
author
thomas loubrieu
committed
update obsolete comment
1 parent f98b9c2 commit 9268b46

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

stac_fastapi/opensearch/stac_fastapi/opensearch/database_logic.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,14 @@ def __attrs_post_init__(self):
154154

155155
aggregation_mapping: Dict[str, Dict[str, Any]] = AGGREGATION_MAPPING
156156

157-
# Private constant for the datetime property field
157+
# constants for field names
158+
# they are used in multiple methods
159+
# and could be overwritten in subclasses used with alternate opensearch mappings.
158160
PROPERTIES_DATETIME_FIELD = "properties.datetime"
159161
PROPERTIES_START_DATETIME_FIELD = "properties.start_datetime"
160162
PROPERTIES_END_DATETIME_FIELD = "properties.end_datetime"
163+
COLLECTION_FIELD = "collection"
164+
GEOMETRY_FIELD = "geometry"
161165

162166
"""CORE LOGIC"""
163167

@@ -441,7 +445,7 @@ def apply_ids_filter(search: Search, item_ids: List[str]):
441445
@staticmethod
442446
def apply_collections_filter(search: Search, collection_ids: List[str]):
443447
"""Database logic to search a list of STAC collection ids."""
444-
return search.filter("terms", collection=collection_ids)
448+
return search.filter("terms", **{DatabaseLogic.COLLECTION_FIELD:collection_ids})
445449

446450
@staticmethod
447451
def apply_free_text_filter(search: Search, free_text_queries: Optional[List[str]]):
@@ -613,7 +617,7 @@ def apply_bbox_filter(search: Search, bbox: List):
613617
Q(
614618
{
615619
"geo_shape": {
616-
"geometry": {
620+
DatabaseLogic.GEOMETRY_FIELD: {
617621
"shape": {
618622
"type": "polygon",
619623
"coordinates": bbox2polygon(*bbox),

0 commit comments

Comments
 (0)