Skip to content

Commit 5f26425

Browse files
committed
extend ExtendedSearch model
1 parent 8141147 commit 5f26425

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from fastapi import APIRouter, FastAPI, Request
66
from fastapi.responses import JSONResponse
77
from pydantic import BaseModel
8+
from stac_pydantic.api.search import ExtendedSearch
89
from starlette.responses import Response
910

1011
from stac_fastapi.api.models import APIRequest
@@ -13,6 +14,12 @@
1314
from stac_fastapi.types.stac import Collections
1415

1516

17+
class CollectionsSearchRequest(ExtendedSearch):
18+
"""Extended search model for collections with free text search support."""
19+
20+
q: Optional[Union[str, List[str]]] = None
21+
22+
1623
class CollectionsSearchEndpointExtension(ApiExtension):
1724
"""Collections search endpoint extension.
1825
@@ -128,10 +135,8 @@ async def collections_search_post_endpoint(
128135
Returns:
129136
Collections: Collections object.
130137
"""
131-
from stac_pydantic.api.search import ExtendedSearch
132-
133138
# Convert the dict to an ExtendedSearch model
134-
search_request = ExtendedSearch.model_validate(body)
139+
search_request = CollectionsSearchRequest.model_validate(body)
135140

136141
# Check if fields are present in the body
137142
if "fields" in body:

0 commit comments

Comments
 (0)