Example #1
0
 def handle(self, *args, **options):
     try:
         command = args[0]
     except:
         raise CommandError('Please provide a valid command')
     
     if command == 'rebuild':
         for model in site.get_models():
             self.stdout.write('Creating index for %s... ' % model.get_name())
             create_index(model)
             update_index(model)
             self.stdout.write('DONE\n')
Example #2
0
    def handle(self, *args, **options):
        try:
            command = args[0]
        except:
            raise CommandError('Please provide a valid command')

        if command == 'rebuild':
            for model in site.get_models():
                self.stdout.write('Creating index for %s... ' %
                                  model.get_name())
                create_index(model)
                update_index(model)
                self.stdout.write('DONE\n')
Example #3
0
def update_index_handler(search_model, sender, instance, created, **kwargs):
    """ Update a record in search index, used on post_save """
    utils.update_index(search_model, instance, created)
Example #4
0
 def rebuild(self):
     mod = site.get_search_model(self.model)
     if mod:
         utils.create_index(mod)
         utils.update_index(mod)
Example #5
0
def update_index_handler(search_model, sender, instance, created, **kwargs):
    """ Update a record in search index, used on post_save """
    utils.update_index(search_model, instance, created)