Skip to content

Commit 6cf20d9

Browse files
Merge branch 'main' into CAT-1522
2 parents 1eaf552 + 504bc6a commit 6cf20d9

File tree

12 files changed

+73
-44
lines changed

12 files changed

+73
-44
lines changed

CHANGELOG.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1010
### Added
1111

1212
- Environment variable `EXCLUDED_FROM_ITEMS` to exclude specific fields from items endpoint response. Supports comma-separated list of fully qualified field names (e.g., `properties.auth:schemes,properties.storage:schemes`) [#518](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/518)
13+
- Added validator for `REDIS_MAX_CONNECTIONS` to handle empty or null-like values ("", "null", None) and return None instead. [#519](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/519)
1314

1415
### Changed
1516

@@ -19,6 +20,18 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1920

2021
### Updated
2122

23+
## [v6.7.2] - 2025-11-04
24+
25+
### Fixed
26+
27+
- Fixed "list index out of range" error when using BETWEEN operator in CQL2-text filters. [#521](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/521)
28+
29+
## [v6.7.1] - 2025-10-31
30+
31+
### Fixed
32+
33+
- Ensure `REDIS_MAX_CONNECTION` can accept `None` and integer value for default number of connection. [#515](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/515)
34+
2235
## [v6.7.0] - 2025-10-27
2336

2437
### Added
@@ -611,7 +624,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
611624
- Use genexp in execute_search and get_all_collections to return results.
612625
- Added db_to_stac serializer to item_collection method in core.py.
613626

614-
[Unreleased]: https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/compare/v6.7.0...main
627+
[Unreleased]: https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/compare/v6.7.2...main
628+
[v6.7.2]: https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/compare/v6.7.1...v6.7.2
629+
[v6.7.1]: https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/compare/v6.7.0...v6.7.1
615630
[v6.7.0]: https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/compare/v6.6.0...v6.7.0
616631
[v6.6.0]: https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/compare/v6.5.1...v6.6.0
617632
[v6.5.1]: https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/compare/v6.5.0...v6.5.1

stac_fastapi/core/stac_fastapi/core/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,7 @@ async def post_search(
830830
search = await self.database.apply_cql2_filter(search, cql2_filter)
831831
except Exception as e:
832832
raise HTTPException(
833-
status_code=400, detail=f"Error with cql2_json filter: {e}"
833+
status_code=400, detail=f"Error with cql2 filter: {e}"
834834
)
835835

836836
if hasattr(search_request, "q"):

stac_fastapi/core/stac_fastapi/core/redis_utils.py

Lines changed: 15 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from typing import List, Optional, Tuple
66
from urllib.parse import parse_qs, urlencode, urlparse, urlunparse
77

8-
from pydantic import field_validator
8+
from pydantic import Field, field_validator
99
from pydantic_settings import BaseSettings
1010
from redis import asyncio as aioredis
1111
from redis.asyncio.sentinel import Sentinel
@@ -21,11 +21,11 @@ class RedisSentinelSettings(BaseSettings):
2121
REDIS_SENTINEL_MASTER_NAME: str = "master"
2222
REDIS_DB: int = 15
2323

24-
REDIS_MAX_CONNECTIONS: int = 10
24+
REDIS_MAX_CONNECTIONS: Optional[int] = None
2525
REDIS_RETRY_TIMEOUT: bool = True
2626
REDIS_DECODE_RESPONSES: bool = True
2727
REDIS_CLIENT_NAME: str = "stac-fastapi-app"
28-
REDIS_HEALTH_CHECK_INTERVAL: int = 30
28+
REDIS_HEALTH_CHECK_INTERVAL: int = Field(default=30, gt=0)
2929
REDIS_SELF_LINK_TTL: int = 1800
3030

3131
@field_validator("REDIS_DB")
@@ -36,20 +36,12 @@ def validate_db_sentinel(cls, v: int) -> int:
3636
raise ValueError("REDIS_DB must be a positive integer")
3737
return v
3838

39-
@field_validator("REDIS_MAX_CONNECTIONS")
39+
@field_validator("REDIS_MAX_CONNECTIONS", mode="before")
4040
@classmethod
41-
def validate_max_connections_sentinel(cls, v: int) -> int:
42-
"""Validate REDIS_MAX_CONNECTIONS is at least 1."""
43-
if v < 1:
44-
raise ValueError("REDIS_MAX_CONNECTIONS must be at least 1")
45-
return v
46-
47-
@field_validator("REDIS_HEALTH_CHECK_INTERVAL")
48-
@classmethod
49-
def validate_health_check_interval_sentinel(cls, v: int) -> int:
50-
"""Validate REDIS_HEALTH_CHECK_INTERVAL is not negative integer."""
51-
if v < 0:
52-
raise ValueError("REDIS_HEALTH_CHECK_INTERVAL must be a positive integer")
41+
def validate_max_connections(cls, v):
42+
"""Handle empty/None values for REDIS_MAX_CONNECTIONS."""
43+
if v in ["", "null", "Null", "NULL", "none", "None", "NONE", None]:
44+
return None
5345
return v
5446

5547
@field_validator("REDIS_SELF_LINK_TTL")
@@ -111,11 +103,11 @@ class RedisSettings(BaseSettings):
111103
REDIS_PORT: int = 6379
112104
REDIS_DB: int = 15
113105

114-
REDIS_MAX_CONNECTIONS: int = 10
106+
REDIS_MAX_CONNECTIONS: Optional[int] = None
115107
REDIS_RETRY_TIMEOUT: bool = True
116108
REDIS_DECODE_RESPONSES: bool = True
117109
REDIS_CLIENT_NAME: str = "stac-fastapi-app"
118-
REDIS_HEALTH_CHECK_INTERVAL: int = 30
110+
REDIS_HEALTH_CHECK_INTERVAL: int = Field(default=30, gt=0)
119111
REDIS_SELF_LINK_TTL: int = 1800
120112

121113
@field_validator("REDIS_PORT")
@@ -134,20 +126,12 @@ def validate_db_standalone(cls, v: int) -> int:
134126
raise ValueError("REDIS_DB must be a positive integer")
135127
return v
136128

137-
@field_validator("REDIS_MAX_CONNECTIONS")
129+
@field_validator("REDIS_MAX_CONNECTIONS", mode="before")
138130
@classmethod
139-
def validate_max_connections_standalone(cls, v: int) -> int:
140-
"""Validate REDIS_MAX_CONNECTIONS is at least 1."""
141-
if v < 1:
142-
raise ValueError("REDIS_MAX_CONNECTIONS must be at least 1")
143-
return v
144-
145-
@field_validator("REDIS_HEALTH_CHECK_INTERVAL")
146-
@classmethod
147-
def validate_health_check_interval_standalone(cls, v: int) -> int:
148-
"""Validate REDIS_HEALTH_CHECK_INTERVAL is not a negative."""
149-
if v < 0:
150-
raise ValueError("REDIS_HEALTH_CHECK_INTERVAL must be a positive integer")
131+
def validate_max_connections(cls, v):
132+
"""Handle empty/None values for REDIS_MAX_CONNECTIONS."""
133+
if v in ["", "null", "Null", "NULL", "none", "None", "NONE", None]:
134+
return None
151135
return v
152136

153137
@field_validator("REDIS_SELF_LINK_TTL")
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
"""library version."""
2-
__version__ = "6.7.0"
2+
__version__ = "6.7.2"

stac_fastapi/elasticsearch/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ keywords = [
3030
]
3131
dynamic = ["version"]
3232
dependencies = [
33-
"stac-fastapi-core==6.7.0",
34-
"sfeos-helpers==6.7.0",
33+
"stac-fastapi-core==6.7.2",
34+
"sfeos-helpers==6.7.2",
3535
"elasticsearch[async]~=8.19.1",
3636
"uvicorn~=0.23.0",
3737
"starlette>=0.35.0,<0.36.0",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
"""library version."""
2-
__version__ = "6.7.0"
2+
__version__ = "6.7.2"

stac_fastapi/opensearch/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ keywords = [
3030
]
3131
dynamic = ["version"]
3232
dependencies = [
33-
"stac-fastapi-core==6.7.0",
34-
"sfeos-helpers==6.7.0",
33+
"stac-fastapi-core==6.7.2",
34+
"sfeos-helpers==6.7.2",
3535
"opensearch-py~=2.8.0",
3636
"opensearch-py[async]~=2.8.0",
3737
"uvicorn~=0.23.0",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
"""library version."""
2-
__version__ = "6.7.0"
2+
__version__ = "6.7.2"

stac_fastapi/sfeos_helpers/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ keywords = [
3131
]
3232
dynamic = ["version"]
3333
dependencies = [
34-
"stac-fastapi.core==6.7.0",
34+
"stac-fastapi.core==6.7.2",
3535
]
3636

3737
[project.urls]

stac_fastapi/sfeos_helpers/stac_fastapi/sfeos_helpers/filter/transform.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,19 @@ def to_es(queryables_mapping: Dict[str, Any], query: Dict[str, Any]) -> Dict[str
9292

9393
elif query["op"] == AdvancedComparisonOp.BETWEEN:
9494
field = to_es_field(queryables_mapping, query["args"][0]["property"])
95-
gte, lte = query["args"][1], query["args"][2]
95+
96+
# Handle both formats: [property, [lower, upper]] or [property, lower, upper]
97+
if len(query["args"]) == 2 and isinstance(query["args"][1], list):
98+
# Format: [{'property': '...'}, [lower, upper]]
99+
gte, lte = query["args"][1][0], query["args"][1][1]
100+
elif len(query["args"]) == 3:
101+
# Format: [{'property': '...'}, lower, upper]
102+
gte, lte = query["args"][1], query["args"][2]
103+
else:
104+
raise ValueError(
105+
f"BETWEEN operator expects 2 or 3 args, got {len(query['args'])}"
106+
)
107+
96108
if isinstance(gte, dict) and "timestamp" in gte:
97109
gte = gte["timestamp"]
98110
if isinstance(lte, dict) and "timestamp" in lte:

0 commit comments

Comments
 (0)