Skip to content

Default batch_size set to None for django 1.7 #22

@xiaolin

Description

@xiaolin

Hi, I am on django 1.7, and I cannot use the --batchsize command to explicitly set a batch_size.

I'm trying to index hundreds of thousands of entries, and they're being indexed one at a time.

The function def reindex_all(self, batch_size=1000): has a default batch_size of 1000, but gets overwritten in the management command.

    def handle(self, *args, **options):
        '''Run the management command.'''
        self.stdout.write('The following models were reindexed:')
        for model in algoliasearch.get_registered_model():
            adapter = algoliasearch.get_adapter(model)
            if options.get('model', None) and not (model.__name__ in
                                                   options['model']):
                continue

            counts = adapter.reindex_all(
                batch_size=options.get('batchsize', None))
            self.stdout.write('\t* {} --> {}'.format(model.__name__, counts))

I think a simple fix is to not override the default batchsize to None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions