Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Fixed

- Fixed bulk_sync_prep_create_item to properly detect duplicates across indexes. [#575](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/575)
- Fixed end_datetime selection when splitting indices in a datetime-based indexing strategy. [#591](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/591)

### Removed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,10 @@ async def _get_target_index_internal(
extract_date(latest_item["_source"]["properties"]["datetime"])
),
end_datetime=str(
extract_date(latest_item["_source"]["properties"]["end_datetime"])
),
extract_first_date_from_index(aliases_dict["end_datetime"])
)
if aliases_dict.get("end_datetime")
else None,
)

await self.datetime_manager.handle_oversized_index(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Async index selectors with datetime-based filtering."""

import logging
from typing import Any, Dict, List, Optional, Tuple

from stac_fastapi.core.utilities import get_bool_env
Expand All @@ -10,6 +10,8 @@
from .base import BaseIndexSelector
from .cache_manager import IndexAliasLoader, IndexCacheManager

logger = logging.getLogger(__name__)


class DatetimeBasedIndexSelector(BaseIndexSelector):
"""Asynchronous index selector that filters indices based on datetime criteria with caching."""
Expand Down Expand Up @@ -104,7 +106,11 @@ async def select_indexes(
)
selected_indexes.extend(filtered_indexes)

return ",".join(selected_indexes) if selected_indexes else ""
if selected_indexes:
return ",".join(selected_indexes)
else:
logger.error("No indexes found matching the datetime criteria.")
return ITEM_INDICES

return ITEM_INDICES

Expand Down