Search code examples
whooshmailman

Mailman 3 Hyperkitty indexes not being built


My config looks like this:

HAYSTACK_CONNECTIONS = {
    'default': {
        'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine',
        'PATH': os.path.join(BASE_DIR, "fulltext_index"),
...

I have whoosh 2.7.4 installed. But my fulltext_index directory contains only one file, _MAIN_0.toc, which hasn't been updated in two years.

What could be going on here? Presumably Hyperkitty should be indexing new messages as they are archived. I could run update_index to fix the index now but then it would just go out of date again.


Solution

  • Hyperkitty updates the index via periodic jobs. You should add the following to e.g. /etc/cron.d/mailman:

    @hourly  mailman  /opt/mailman/venv/bin/mailman-web runjobs hourly
    @daily   mailman  /opt/mailman/venv/bin/mailman-web runjobs daily
    @weekly  mailman  /opt/mailman/venv/bin/mailman-web runjobs weekly
    @monthly mailman  /opt/mailman/venv/bin/mailman-web runjobs monthly
    @yearly  mailman  /opt/mailman/venv/bin/mailman-web runjobs yearly
    * * * * *  mailman  /opt/mailman/venv/bin/mailman-web runjobs minutely
    2,17,32,47 * * * * mailman  /opt/mailman/venv/bin/mailman-web runjobs quarter_hourly
    

    This snippet is taken from page
    https://docs.mailman3.org/en/latest/config-web.html#scheduled-tasks-required

    You can also check an example project in the Hyperkitty repo that contains the following crontab example:

    # This goes in /etc/cron.d/.
    # Replace "apache" by your webserver user ("www-data" on Debian systems) and
    # set the path to the Django project directory
    
    @hourly  apache  django-admin runjobs hourly  --pythonpath /path/to/project --settings settings
    @daily   apache  django-admin runjobs daily   --pythonpath /path/to/project --settings settings
    @weekly  apache  django-admin runjobs weekly  --pythonpath /path/to/project --settings settings
    @monthly apache  django-admin runjobs monthly --pythonpath /path/to/project --settings settings
    @yearly  apache  django-admin runjobs yearly  --pythonpath /path/to/project --settings settings
    
    # Currently Hyperkitty has no minutely and quarter_hourly jobs.  The purpose of
    # the next lines is to ease the upgrading process, in the eventual case that
    # Hyperkitty will utilize minutely or quarter_hourly jobs.
    2,17,32,47 * * * * apache  django-admin runjobs quarter_hourly --pythonpath /path/to/project --settings settings
    * * * * *  apache  django-admin runjobs minutely  --pythonpath /path/to/project --settings settings