diff --git a/apps/document_indexing/tools.py b/apps/document_indexing/tools.py index 07e62c83ce..71837b0930 100644 --- a/apps/document_indexing/tools.py +++ b/apps/document_indexing/tools.py @@ -2,15 +2,17 @@ from __future__ import absolute_import from documents.models import Document -from .models import IndexInstanceNode, DocumentRenameCount +from .models import Index, IndexInstanceNode, DocumentRenameCount from .filesystem import fs_delete_directory_recusive from .api import update_indexes def do_rebuild_all_indexes(): - fs_delete_directory_recusive() - IndexInstanceNode.objects.delete() - DocumentRenameCount.objects.delete() + for index in Index.objects.all(): + fs_delete_directory_recusive(index) + + IndexInstanceNode.objects.all().delete() + DocumentRenameCount.objects.all().delete() for document in Document.objects.all(): update_indexes(document)