The other day I found Gmvault.

Gmvault is an open source Gmail backup software written in Python.

This article provides a good overview on how it works (found it better than the Gmvault documentation):

It uses IMAP to connect to Gmail and also stores files in .eml (plain text) formatted fails. It has a converter to export to mbox and Maildir formats.

Probably would be good for archiving and using mnoGoSearch for search front end.