Skip to content

Commit 2074b15

Browse files
Merge branch 'main' into CAT-1490-2
2 parents ac778fb + 18185f3 commit 2074b15

File tree

14 files changed

+421
-240
lines changed

14 files changed

+421
-240
lines changed

CHANGELOG.md

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

1616
### Fixed
1717

18+
[v6.5.1] - 2025-09-30
19+
20+
### Fixed
21+
22+
- Issue where token, query param was not being passed to POST collections search logic [#483](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/483)
23+
- Issue where datetime param was not being passed from POST collections search logic to Elasticsearch [#483](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/483)
24+
- Collections search tests to ensure both GET /collections and GET/POST /collections-search endpoints are tested [#483](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/483)
25+
1826
[v6.5.0] - 2025-09-29
1927

2028
### Added
@@ -549,7 +557,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
549557
- Use genexp in execute_search and get_all_collections to return results.
550558
- Added db_to_stac serializer to item_collection method in core.py.
551559

552-
[Unreleased]: https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/compare/v6.5.0...main
560+
[Unreleased]: https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/compare/v6.5.1...main
561+
[v6.5.1]: https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/compare/v6.5.0...v6.5.1
553562
[v6.5.0]: https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/compare/v6.4.0...v6.5.0
554563
[v6.4.0]: https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/compare/v6.3.0...v6.4.0
555564
[v6.3.0]: https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/compare/v6.2.1...v6.3.0

compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ services:
2222
- ES_VERIFY_CERTS=false
2323
- BACKEND=elasticsearch
2424
- DATABASE_REFRESH=true
25+
- ENABLE_COLLECTIONS_SEARCH_ROUTE=true
2526
ports:
2627
- "8080:8080"
2728
volumes:
@@ -56,6 +57,7 @@ services:
5657
- ES_VERIFY_CERTS=false
5758
- BACKEND=opensearch
5859
- STAC_FASTAPI_RATE_LIMIT=200/minute
60+
- ENABLE_COLLECTIONS_SEARCH_ROUTE=true
5961
ports:
6062
- "8082:8082"
6163
volumes:

stac_fastapi/core/stac_fastapi/core/core.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,14 +240,16 @@ async def landing_page(self, **kwargs) -> stac_types.LandingPage:
240240

241241
async def all_collections(
242242
self,
243-
datetime: Optional[str] = None,
244243
limit: Optional[int] = None,
244+
datetime: Optional[str] = None,
245245
fields: Optional[List[str]] = None,
246246
sortby: Optional[Union[str, List[str]]] = None,
247247
filter_expr: Optional[str] = None,
248248
filter_lang: Optional[str] = None,
249249
q: Optional[Union[str, List[str]]] = None,
250250
query: Optional[str] = None,
251+
request: Request = None,
252+
token: Optional[str] = None,
251253
**kwargs,
252254
) -> stac_types.Collections:
253255
"""Read all collections from the database.
@@ -266,7 +268,6 @@ async def all_collections(
266268
Returns:
267269
A Collections object containing all the collections in the database and links to various resources.
268270
"""
269-
request = kwargs["request"]
270271
base_url = str(request.base_url)
271272

272273
# Get the global limit from environment variable
@@ -292,7 +293,9 @@ async def all_collections(
292293
if global_max_limit > 0:
293294
limit = min(limit, global_max_limit)
294295

295-
token = request.query_params.get("token")
296+
# Get token from query params only if not already provided (for GET requests)
297+
if token is None:
298+
token = request.query_params.get("token")
296299

297300
# Process fields parameter for filtering collection properties
298301
includes, excludes = set(), set()
@@ -493,6 +496,10 @@ async def post_all_collections(
493496
# Pass all parameters from search_request to all_collections
494497
return await self.all_collections(
495498
limit=search_request.limit if hasattr(search_request, "limit") else None,
499+
datetime=search_request.datetime
500+
if hasattr(search_request, "datetime")
501+
else None,
502+
token=search_request.token if hasattr(search_request, "token") else None,
496503
fields=fields,
497504
sortby=sortby,
498505
filter_expr=search_request.filter

stac_fastapi/core/stac_fastapi/core/extensions/collections_search.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ class CollectionsSearchRequest(ExtendedSearch):
1818
"""Extended search model for collections with free text search support."""
1919

2020
q: Optional[Union[str, List[str]]] = None
21+
token: Optional[str] = None
22+
query: Optional[
23+
str
24+
] = None # Legacy query extension (deprecated but still supported)
2125

2226

2327
class CollectionsSearchEndpointExtension(ApiExtension):
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
"""library version."""
2-
__version__ = "6.5.0"
2+
__version__ = "6.5.1"

stac_fastapi/elasticsearch/setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
desc = f.read()
77

88
install_requires = [
9-
"stac-fastapi-core==6.5.0",
10-
"sfeos-helpers==6.5.0",
9+
"stac-fastapi-core==6.5.1",
10+
"sfeos-helpers==6.5.1",
1111
"elasticsearch[async]~=8.18.0",
1212
"uvicorn~=0.23.0",
1313
"starlette>=0.35.0,<0.36.0",

stac_fastapi/elasticsearch/stac_fastapi/elasticsearch/database_logic.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,6 @@ async def get_all_collections(
309309
query_parts.append(search_dict["query"])
310310

311311
except Exception as e:
312-
logger = logging.getLogger(__name__)
313312
logger.error(f"Error converting query to Elasticsearch: {e}")
314313
# If there's an error, add a query that matches nothing
315314
query_parts.append({"bool": {"must_not": {"match_all": {}}}})
@@ -381,7 +380,6 @@ async def get_all_collections(
381380
try:
382381
matched = count_task.result().get("count")
383382
except Exception as e:
384-
logger = logging.getLogger(__name__)
385383
logger.error(f"Count task failed: {e}")
386384

387385
return collections, next_token, matched
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
"""library version."""
2-
__version__ = "6.5.0"
2+
__version__ = "6.5.1"

stac_fastapi/opensearch/setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
desc = f.read()
77

88
install_requires = [
9-
"stac-fastapi-core==6.5.0",
10-
"sfeos-helpers==6.5.0",
9+
"stac-fastapi-core==6.5.1",
10+
"sfeos-helpers==6.5.1",
1111
"opensearch-py~=2.8.0",
1212
"opensearch-py[async]~=2.8.0",
1313
"uvicorn~=0.23.0",

stac_fastapi/opensearch/stac_fastapi/opensearch/database_logic.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,6 @@ async def get_all_collections(
293293
query_parts.append(search_dict["query"])
294294

295295
except Exception as e:
296-
logger = logging.getLogger(__name__)
297296
logger.error(f"Error converting query to OpenSearch: {e}")
298297
# If there's an error, add a query that matches nothing
299298
query_parts.append({"bool": {"must_not": {"match_all": {}}}})
@@ -365,7 +364,6 @@ async def get_all_collections(
365364
try:
366365
matched = count_task.result().get("count")
367366
except Exception as e:
368-
logger = logging.getLogger(__name__)
369367
logger.error(f"Count task failed: {e}")
370368

371369
return collections, next_token, matched

0 commit comments

Comments
 (0)