Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

increase indexing speed

jonaswinkler6968e228e173
diff --git a/src/documents/management/commands/document_index.py b/src/documents/management/commands/document_index.py
index 7dfdbaa42..08e20e1d2 100644
--- a/src/documents/management/commands/document_index.py
+++ b/src/documents/management/commands/document_index.py
@@ -1,4 +1,5 @@
from django.core.management import BaseCommand
+from django.db import transaction
from documents.mixins import Renderable
from documents.tasks import index_reindex, index_optimize
@@ -18,8 +19,8 @@ class Command(Renderable, BaseCommand):
def handle(self, *args, **options):
self.verbosity = options["verbosity"]
-
- if options['command'] == 'reindex':
- index_reindex()
- elif options['command'] == 'optimize':
- index_optimize()
+ with transaction.atomic():
+ if options['command'] == 'reindex':
+ index_reindex()
+ elif options['command'] == 'optimize':
+ index_optimize()