Skip to content

Commit

Permalink
fix broken test, re archesproject#9799
Browse files Browse the repository at this point in the history
  • Loading branch information
apeters committed Aug 19, 2023
1 parent ce54b6f commit 48c8c29
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion arches/app/search/elasticsearch_dsl_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def count(self, index="", **kwargs):
return self.se.count(index=index, **self.dsl)

def delete(self, index="", **kwargs):
return self.se.delete(index=index, **self.dsl, **kwargs)
return self.se.delete(index=index, query=self.dsl, **kwargs)

def prepare(self, scroll=False):
if self.scroll is None:
Expand Down
10 changes: 5 additions & 5 deletions arches/app/search/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ def delete(self, **kwargs):
"""

kwargs = self._add_prefix(**kwargs)
body = kwargs.pop("body", None)
if body is not None:
query = kwargs.pop("query", None)
if query is not None:
try:
data = []
refresh = kwargs.pop("refresh", False)
for hit in helpers.scan(self.es, query=body, **kwargs):
for hit in helpers.scan(self.es, query=query, **kwargs):
hit["_op_type"] = "delete"
data.append(hit)

Expand All @@ -97,14 +97,14 @@ def delete(self, **kwargs):
pass
except:
self.logger.warning(
"%s: WARNING: failed to delete document by query: %s \nException detail: %s\n" % (datetime.now(), body, detail)
"%s: WARNING: failed to delete document by query: %s \nException detail: %s\n" % (datetime.now(), query, detail)
)
raise detail
else:
try:
return self.es.options(ignore_status=404).delete(**kwargs)
except Exception as detail:
self.logger.warning("%s: WARNING: failed to delete document: %s \nException detail: %s\n" % (datetime.now(), body, detail))
self.logger.warning("%s: WARNING: failed to delete document: %s \nException detail: %s\n" % (datetime.now(), kwargs, detail))
raise detail

def delete_index(self, **kwargs):
Expand Down

0 comments on commit 48c8c29

Please sign in to comment.