Skip to content

Commit 4416fe7

Browse files
Merge branch 'main' into CAT-1382-2
2 parents 11655d9 + 18185f3 commit 4416fe7

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
@@ -245,14 +245,16 @@ async def landing_page(self, **kwargs) -> stac_types.LandingPage:
245245

246246
async def all_collections(
247247
self,
248-
datetime: Optional[str] = None,
249248
limit: Optional[int] = None,
249+
datetime: Optional[str] = None,
250250
fields: Optional[List[str]] = None,
251251
sortby: Optional[Union[str, List[str]]] = None,
252252
filter_expr: Optional[str] = None,
253253
filter_lang: Optional[str] = None,
254254
q: Optional[Union[str, List[str]]] = None,
255255
query: Optional[str] = None,
256+
request: Request = None,
257+
token: Optional[str] = None,
256258
**kwargs,
257259
) -> stac_types.Collections:
258260
"""Read all collections from the database.
@@ -271,7 +273,6 @@ async def all_collections(
271273
Returns:
272274
A Collections object containing all the collections in the database and links to various resources.
273275
"""
274-
request = kwargs["request"]
275276
base_url = str(request.base_url)
276277

277278
# Get the global limit from environment variable
@@ -303,7 +304,9 @@ async def all_collections(
303304
else:
304305
limit = 10
305306

306-
token = request.query_params.get("token")
307+
# Get token from query params only if not already provided (for GET requests)
308+
if token is None:
309+
token = request.query_params.get("token")
307310

308311
# Process fields parameter for filtering collection properties
309312
includes, excludes = set(), set()
@@ -527,6 +530,10 @@ async def post_all_collections(
527530
# Pass all parameters from search_request to all_collections
528531
return await self.all_collections(
529532
limit=search_request.limit if hasattr(search_request, "limit") else None,
533+
datetime=search_request.datetime
534+
if hasattr(search_request, "datetime")
535+
else None,
536+
token=search_request.token if hasattr(search_request, "token") else None,
530537
fields=fields,
531538
sortby=sortby,
532539
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)