datamade / django-councilmatic

:heartpulse: Django app providing core functions for *.councilmatic.org
http://councilmatic.org
MIT License
26 stars 16 forks source link

Override Haystack commands #219

Closed reginafcompton closed 4 years ago

reginafcompton commented 6 years ago

This PR contains two managements commands that override existing ones in Haystack: update_index and rebuild_index. The new commands assign default values to the batch-size, so that humans can manually execute this command, without worrying about adding this argument.

For this to work, councilmatic_core must be about haystack in settings.py: https://docs.djangoproject.com/en/2.1/howto/custom-management-commands/#overriding-commands

Responds to devops issue https://github.com/datamade/devops/issues/42

@evz and I discussed this already, but would appreciate your input @fgregg

hancush commented 4 years ago

You can configure a default batch size in the Haystack connection, like this:

HAYSTACK_CONNECTIONS = {
    'default': {
        'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
        'URL': 'http://solr:8983/solr/lametro',
        'SILENTLY_FAIL': False,  # Raise Solr errors
        'BATCH_SIZE': 100,  # Reduce the default batch size for index updates
    },
}

We should add this to our Councilmatic template, but I don't think we need to bring this change in.