Skip to content

Commit aa4dfbf

Browse files
es indices() empty list
1 parent 45cd558 commit aa4dfbf

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

stac_fastapi/elasticsearch/stac_fastapi/elasticsearch/database_logic.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def indices(collection_ids: Optional[List[str]]) -> str:
168168
Returns:
169169
A string of comma-separated index names. If `collection_ids` is None, returns the default indices.
170170
"""
171-
if collection_ids is None:
171+
if collection_ids is None or collection_ids == []:
172172
return ITEM_INDICES
173173
else:
174174
return ",".join([index_by_collection_id(c) for c in collection_ids])
@@ -764,7 +764,6 @@ def _fill_aggregation_parameters(name: str, agg: dict) -> dict:
764764
for k, v in self.aggregation_mapping.items()
765765
if k in aggregations
766766
}
767-
768767
index_param = indices(collection_ids)
769768
search_task = asyncio.create_task(
770769
self.client.search(

stac_fastapi/tests/extensions/test_aggregation.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ async def test_aggregate_filter_extension_neq_post(app_client, ctx):
173173

174174

175175
@pytest.mark.asyncio
176-
async def test_aggregate_extension_gte_get(app_client):
176+
async def test_aggregate_extension_gte_get(app_client, ctx):
177177
# there's one item that can match, so one of these queries should match it and the other shouldn't
178178
resp = await app_client.get(
179179
'/aggregate?aggregations=total_count&filter-lang=cql2-json&filter={"op":"<=","args":[{"property": "properties.proj:epsg"},32756]}'
@@ -387,9 +387,7 @@ async def test_aggregate_datetime_non_interval(app_client):
387387
@pytest.mark.asyncio
388388
async def test_post_aggregate_total_count(app_client):
389389

390-
params = {
391-
"aggregations": ["total_count"],
392-
}
390+
params = {"aggregations": ["total_count"]}
393391

394392
resp = await app_client.post("/aggregate", json=params)
395393

0 commit comments

Comments
 (0)