fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add committing, too
[wolnelektury.git]
/
apps
/
search
/
management
/
commands
/
reindex.py
diff --git
a/apps/search/management/commands/reindex.py
b/apps/search/management/commands/reindex.py
index
3b6517f
..
2d2000b
100755
(executable)
--- a/
apps/search/management/commands/reindex.py
+++ b/
apps/search/management/commands/reindex.py
@@
-14,9
+14,8
@@
class Command(BaseCommand):
def handle(self, *args, **opts):
from catalogue.models import Book
import search
def handle(self, *args, **opts):
from catalogue.models import Book
import search
- idx = search.ReusableIndex()
- idx.open()
-
+ idx = search.Index()
+
if not opts['just_tags']:
if args:
books = []
if not opts['just_tags']:
if args:
books = []
@@
-27,10
+26,14
@@
class Command(BaseCommand):
books += Book.objects.filter(slug=a).all()
else:
books = Book.objects.all()
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()
print 'Reindexing tags.'
idx.index_tags()
- idx.
close
()
+ idx.
index.commit
()