File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
stac_fastapi/sfeos_helpers/stac_fastapi/sfeos_helpers/database Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -150,14 +150,15 @@ def remove_commands(commands: ESCommandSet, path: ElasticPath) -> None:
150150 path (ElasticPath): Path to value to be removed
151151
152152 """
153+ commands .add (f"def { path .variable_name } ;" )
153154 if isinstance (path .key , int ):
154155 commands .add (
155156 f"if (ctx._source{ path .es_nest } instanceof ArrayList)"
156- f"{{def { path .variable_name } = ctx._source{ path .es_nest } .remove({ path .es_key } );}} else "
157+ f"{{{ path .variable_name } = ctx._source{ path .es_nest } .remove({ path .es_key } );}} else "
157158 )
158159
159160 commands .add (
160- f"def { path .variable_name } = ctx._source{ path .es_nest } .remove('{ path .key } ');"
161+ f"{ path .variable_name } = ctx._source{ path .es_nest } .remove('{ path .key } ');"
161162 )
162163
163164
@@ -190,11 +191,12 @@ def add_commands(
190191 if isinstance (path .key , int ):
191192 commands .add (
192193 f"if (ctx._source{ path .es_nest } instanceof ArrayList)"
193- f"{{ctx._source{ path .es_nest } .{ 'add' if operation .op in ['add' , 'move' ] else 'set' } ({ path .es_key } , { value } )}}"
194- f" else "
194+ f"{{ctx._source{ path .es_nest } .{ 'add' if operation .op in ['add' , 'move' ] else 'set' } ({ path .es_key } , { value } ); }}"
195+ f" else ctx._source { path . es_nest } [' { path . es_key } '] = { value } ; "
195196 )
196197
197- commands .add (f"ctx._source{ path .es_path } = { value } ;" )
198+ else :
199+ commands .add (f"ctx._source{ path .es_path } = { value } ;" )
198200
199201
200202def test_commands (
You can’t perform that action at this time.
0 commit comments