def handle(self, *commands, **options): if not commands: print self.help else: s = SolrIndex() for command in commands: if command == 'optimize': s.optimize() elif command == 'index': s.index(verbose=True) elif command == 'reindex': s.index(verbose=True, all=True) s.clear_missing(verbose=True) elif command == 'clean': s.clear_missing(verbose=True) elif command == 'rebuild': s.clear() s.index(verbose=True, all=True) elif command == 'clear': s.clear() else: print "Invalid command %s" % command
def handle(self, *args, **kwargs): if not args: print self.help else: collections = map(int, kwargs.get('collections') or list()) s = SolrIndex() for command in args: if command == 'optimize': s.optimize() elif command == 'index': s.index(verbose=True) elif command == 'reindex': s.index(verbose=True, all=True, collections=collections) s.clear_missing(verbose=True) elif command == 'clean': s.clear_missing(verbose=True) elif command == 'rebuild': s.clear() s.index(verbose=True, all=True, collections=collections) elif command == 'clear': s.clear() else: print "Invalid command %s" % command