X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/d52c76021eaf1621b4e55a6eba1df1c0404bd7dd..d90edc4826d6c3d3a40f52fa5c88cf4b1741ab63:/apps/search/management/commands/reindex.py?ds=sidebyside diff --git a/apps/search/management/commands/reindex.py b/apps/search/management/commands/reindex.py new file mode 100755 index 000000000..9639a5ae7 --- /dev/null +++ b/apps/search/management/commands/reindex.py @@ -0,0 +1,16 @@ +from django.core.management.base import BaseCommand + +class Command(BaseCommand): + help = 'Reindex everything.' + args = '' + + def handle(self, *args, **opts): + from catalogue.models import Book + import search + idx = search.ReusableIndex() + idx.open() + for b in Book.objects.all(): + print b.title + idx.index_book(b, None) + print 'Reindexing tags.' + idx.index_tags()