Skip to content

Commit 1f726c7

Browse files
committed
more clean up
1 parent e5c4b72 commit 1f726c7

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

stac_fastapi/opensearch/stac_fastapi/opensearch/database_logic.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ async def get_all_collections(
162162
q: Optional[List[str]] = None,
163163
filter: Optional[Dict[str, Any]] = None,
164164
) -> Tuple[List[Dict[str, Any]], Optional[str]]:
165-
"""Retrieve a list of collections from Elasticsearch, supporting pagination.
165+
"""Retrieve a list of collections from Opensearch, supporting pagination.
166166
167167
Args:
168168
token (Optional[str]): The pagination token.
@@ -193,7 +193,7 @@ async def get_all_collections(
193193
raise HTTPException(
194194
status_code=400,
195195
detail=f"Field '{field}' is not sortable. Sortable fields are: {', '.join(sortable_fields)}. "
196-
+ "Text fields are not sortable by default in Elasticsearch. "
196+
+ "Text fields are not sortable by default in Opensearch. "
197197
+ "To make a field sortable, update the mapping to use 'keyword' type or add a '.keyword' subfield. ",
198198
)
199199
formatted_sort.append({field: {"order": direction}})
@@ -250,7 +250,7 @@ async def get_all_collections(
250250
# Convert string filter to dict if needed
251251
if isinstance(filter, str):
252252
filter = orjson.loads(filter)
253-
# Convert the filter to an Elasticsearch query using the filter module
253+
# Convert the filter to an Opensearch query using the filter module
254254
es_query = filter_module.to_es(await self.get_queryables_mapping(), filter)
255255
query_parts.append(es_query)
256256

@@ -298,7 +298,7 @@ async def get_one_item(self, collection_id: str, item_id: str) -> Dict:
298298
NotFoundError: If the specified Item does not exist in the Collection.
299299
300300
Notes:
301-
The Item is retrieved from the Elasticsearch database using the `client.get` method,
301+
The Item is retrieved from the Opensearch database using the `client.get` method,
302302
with the index for the Collection as the target index and the combined `mk_item_id` as the document id.
303303
"""
304304
try:
@@ -602,10 +602,6 @@ async def apply_cql2_filter(
602602
otherwise the original Search object.
603603
"""
604604
if _filter is not None:
605-
if isinstance(_filter, str):
606-
import json
607-
608-
_filter = json.loads(_filter)
609605
es_query = filter_module.to_es(await self.get_queryables_mapping(), _filter)
610606
search = search.filter(es_query)
611607

stac_fastapi/tests/api/test_api_search_collections.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ async def test_collections_free_text_search_get(app_client, txn_client, load_tes
164164
# Use unique prefixes to avoid conflicts between tests
165165
test_prefix = f"q-get-{uuid.uuid4().hex[:8]}"
166166

167-
# Create collections with different content to test structured filter
168167
test_collections = [
169168
{
170169
"id": f"{test_prefix}-sentinel",

0 commit comments

Comments
 (0)