1 from django.core.management.base import BaseCommand
3 from optparse import make_option
4 class Command(BaseCommand):
5 help = 'Reindex everything.'
8 option_list = BaseCommand.option_list + (
9 make_option('-n', '--book-id', action='store_true', dest='book_id', default=False,
10 help='book id instead of slugs'),
11 make_option('-t', '--just-tags', action='store_true', dest='just_tags', default=False,
12 help='just reindex tags'),
14 def handle(self, *args, **opts):
15 from catalogue.models import Book
17 idx = search.ReusableIndex()
20 if not opts['just_tags']:
25 books += Book.objects.filter(id=int(a)).all()
27 books += Book.objects.filter(slug=a).all()
29 books = Book.objects.all()
34 print 'Reindexing tags.'