From 6b30b67fe7dffaf2475e69621353e6edb1867e5f Mon Sep 17 00:00:00 2001 From: Michael Shamoon <4887959+shamoon@users.noreply.github.com> Date: Wed, 25 Jan 2023 12:04:13 -0800 Subject: [PATCH] Trigger reindex on comment add / delete --- src/documents/views.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/documents/views.py b/src/documents/views.py index e2807edff..854f2da2b 100644 --- a/src/documents/views.py +++ b/src/documents/views.py @@ -445,6 +445,10 @@ class DocumentViewSet( ) c.save() + from documents import index + + index.add_or_update_document(self.get_object()) + return Response(self.getComments(doc)) except Exception as e: logger.warning(f"An error occurred saving comment: {str(e)}") @@ -456,6 +460,11 @@ class DocumentViewSet( elif request.method == "DELETE": comment = Comment.objects.get(id=int(request.GET.get("id"))) comment.delete() + + from documents import index + + index.add_or_update_document(self.get_object()) + return Response(self.getComments(doc)) return Response(