2 from django.core.management.base import BaseCommand
3 from search import IndexChecker
5 class Command(BaseCommand):
6 help = 'Check Lucene search index'
9 def handle(self, *args, **opts):
10 checker = IndexChecker()
11 status = checker.check()
13 print "No problems found."
15 if status.missingSegments:
16 print "Unable to locate."
17 print "Number of bad segments: %d / %d (max segment name is %d)" % \
18 (status.numBadSegments, status.numSegments, status.maxSegmentName)
19 print "Total lost documents (due to bad segments) %d" % status.totLoseDocCount
20 if not status.validCounter:
21 print "Segment counter is not valid."