search fixes
[wolnelektury.git] / apps / search / management / commands / reindex.py
1 from django.core.management.base import BaseCommand
2
3 class Command(BaseCommand):
4     help = 'Reindex everything.'
5     args = ''
6
7     def handle(self, *args, **opts):
8         from catalogue.models import Book
9         import search
10         idx = search.ReusableIndex()
11         idx.open()
12         for b in Book.objects.all():
13             print b.title
14             idx.index_book(b, None)
15         print 'Reindexing tags.'
16         idx.index_tags()