Skip to content

Commit c720ac3

Browse files
committed
Refresh after id changes.
1 parent 6905919 commit c720ac3

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

stac_fastapi/core/stac_fastapi/core/utilities.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ def add_commands(
348348

349349

350350
def test_commands(
351-
commands: ESCommandSet, operation: PatchOperation, path: ElasticPath
351+
commands: ESCommandSet, operation: PatchOperation, path: ElasticPath, params: Dict
352352
) -> None:
353353
"""Test value at path.
354354
@@ -357,8 +357,11 @@ def test_commands(
357357
operation (PatchOperation): operation to run
358358
path (ElasticPath): path for value to be tested
359359
"""
360+
value = f"params.{path.param_key}"
361+
params[path.param_key] = operation.value
362+
360363
commands.add(
361-
f"if (ctx._source.{path.es_path} != {operation.json_value})"
364+
f"if (ctx._source.{path.es_path} != {value})"
362365
f"{{Debug.explain('Test failed `{path.path}` | "
363366
f"{operation.json_value} != ' + ctx._source.{path.es_path});}}"
364367
)

stac_fastapi/elasticsearch/stac_fastapi/elasticsearch/database_logic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,7 +1057,7 @@ async def json_patch_item(
10571057
if new_item_id:
10581058
item["id"] = new_item_id
10591059
item = await self.async_prep_create_item(item=item, base_url=base_url)
1060-
await self.create_item(item=item, refresh=False)
1060+
await self.create_item(item=item, refresh=True)
10611061

10621062
await self.delete_item(
10631063
item_id=item_id,
@@ -1353,7 +1353,7 @@ async def json_patch_collection(
13531353
await self.update_collection(
13541354
collection_id=collection_id,
13551355
collection=collection,
1356-
refresh=False,
1356+
refresh=refresh,
13571357
)
13581358

13591359
return collection

stac_fastapi/opensearch/stac_fastapi/opensearch/database_logic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,7 @@ async def json_patch_item(
10621062
if new_item_id:
10631063
item["id"] = new_item_id
10641064
item = await self.prep_create_item(item=item, base_url=base_url)
1065-
await self.create_item(item=item, refresh=False)
1065+
await self.create_item(item=item, refresh=True)
10661066

10671067
if new_collection_id or new_item_id:
10681068

@@ -1332,7 +1332,7 @@ async def json_patch_collection(
13321332
collection["id"] = new_collection_id
13331333
collection["links"] = resolve_links([], base_url)
13341334
await self.update_collection(
1335-
collection_id=collection_id, collection=collection, refresh=False
1335+
collection_id=collection_id, collection=collection, refresh=True
13361336
)
13371337

13381338
return collection

0 commit comments

Comments
 (0)