From 5f472f9710d81657a3aa6e3a170ce123e1ac3099 Mon Sep 17 00:00:00 2001 From: Marcin Koziej Date: Fri, 26 Oct 2012 13:04:45 +0200 Subject: [PATCH 1/1] add committing, too --- apps/search/management/commands/reindex.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/apps/search/management/commands/reindex.py b/apps/search/management/commands/reindex.py index b1ec9c3d7..2d2000bb9 100755 --- a/apps/search/management/commands/reindex.py +++ b/apps/search/management/commands/reindex.py @@ -26,9 +26,14 @@ class Command(BaseCommand): books += Book.objects.filter(slug=a).all() else: books = Book.objects.all() - - for b in books: - print b.title - idx.index_book(b) + + try: + for b in books: + print b.title + idx.index_book(b) + idx.index.commit() + except: + idx.index.rollback() print 'Reindexing tags.' idx.index_tags() + idx.index.commit() -- 2.20.1