Squatter indexes Cyrus mailboxes for faster searching
The version Apple includes in OS X Server is a bit busted so download it here.UPDATED – 11/25/05 – This procedure only works on 10.3. As of 10.4.3 all of this is included with the system and works as it should.
What is this?
Squatter is the mailbox indexing utility that is part of the Cyrus mail server suite. While Apple included a copy of squatter in a standard OS X Server install, it seems to be broken. This is a straight compile of the latest version 2.1.16.
This package will do:
Squatter creates index files of Cyrus mailboxes allowing you to do IMAP searches faster. For example in non-scientific tests done with a mailbox of over 15,000 messages Mail.app took 30 seconds to do a content search for a term, whereas Squirrelmail, which uses the IMAP server to search rather than a local cache of the e-mails, took 3 seconds.
The side effect of this ten-fold increase in speed is a large index file. The sample mailbox of 15,000 e-mails is about 60 MB in size. After running squatter on the mailbox a 40 MB index file was created in that mailbox. Now, IMAP clients will not pull this file down, so you don’t need to worry about filling up your clients or burning bandwidth. However, do be aware that your disk space usage on the server will go up.
Run squatter by calling it by hand, or through a cron job. Keep in mind that you need to run it as the cyrus user.
sudo -u cyrus /usr/bin/cyrus/bin/squatter
Some common flags you might want to use:
-v : verbose output, great for troubleshooting
-r : recursively index mailboxes starting from a particular one that is listed after the flag
You can also specify a mailbox as an argument, using the Cyrus internal naming structure for that mailbox. This will cause squatter to index only that mailbox. Calling squatter without any arguments will cause it to index all mailboxes on the system.
For example. I have a mailbox of all the Apple OS X Server mailing list traffic for the last year. I would like to index this. However, I have no desire to index my primary inbox, nor my sent mail since I hardly ever have need to search these folders. I have a cron job set up to run this command every night:
/usr/bin/cyrus/bin/squatter user/mactroll/Lists/Apple Server List
Note the strange naming convention for the mailbox path. This is NOT the file system path to the mailbox, but rather the internal Cyrus naming convention. The easiest way to find out this path is to either use cyradm, or to run squatter in verbose mode where it will log all mailboxes that it is indexing.
The squatter man page is installed on the system, so read that if you have any further questions.