Skip to content

Commit ec8e97a

Browse files
Yuri ZmytrakovYuri Zmytrakov
authored andcommitted
first commit
1 parent 375bb8d commit ec8e97a

File tree

4 files changed

+424
-179
lines changed

4 files changed

+424
-179
lines changed

stac_fastapi/core/stac_fastapi/core/core.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -800,6 +800,12 @@ async def post_search(
800800
logger.error(msg)
801801
raise HTTPException(status_code=400, detail=msg)
802802

803+
if datetime_search and search_request.collections:
804+
search = self.database.apply_index_selection(
805+
search=search,
806+
datetime_search=datetime_search,
807+
collections=search_request.collections,
808+
)
803809
if search_request.bbox:
804810
bbox = search_request.bbox
805811
if len(bbox) == 6:

stac_fastapi/elasticsearch/stac_fastapi/elasticsearch/database_logic.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,20 @@ def apply_collections_filter(search: Search, collection_ids: List[str]):
433433
"""Database logic to search a list of STAC collection ids."""
434434
return search.filter("terms", collection=collection_ids)
435435

436+
# Add this method to the Elasticsearch DatabaseLogic class
437+
@staticmethod
438+
def apply_index_selection(
439+
search: Search,
440+
datetime_search: Optional[Dict[str, Optional[str]]],
441+
collections: Optional[List[str]],
442+
) -> Search:
443+
"""Apply index selection based on datetime analysis and collections.
444+
445+
For Elasticsearch, this might be a no-op or implement different logic
446+
since Elasticsearch doesn't use the same AST pattern as OpenSearch.
447+
"""
448+
return search
449+
436450
@staticmethod
437451
def apply_datetime_filter(
438452
search: Search, datetime: Optional[str]

0 commit comments

Comments
 (0)