<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Something better to do &#187; Richard Curnow</title>
	<atom:link href="http://blog.kamens.us/tag/richard-curnow/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.kamens.us</link>
	<description>Musings of an indignant mind</description>
	<lastBuildDate>Tue, 17 Aug 2010 12:30:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
			<item>
		<title>My new favorite open-source software: mairix by Richard Curnow</title>
		<link>http://blog.kamens.us/2010/01/08/my-new-favorite-open-source-software-mairix-by-richard-curnow/</link>
		<comments>http://blog.kamens.us/2010/01/08/my-new-favorite-open-source-software-mairix-by-richard-curnow/#comments</comments>
		<pubDate>Fri, 08 Jan 2010 15:58:48 +0000</pubDate>
		<dc:creator>jik</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Free software]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[email searching]]></category>
		<category><![CDATA[freeWAIS]]></category>
		<category><![CDATA[mairix]]></category>
		<category><![CDATA[mbox]]></category>
		<category><![CDATA[Richard Curnow]]></category>

		<guid isPermaLink="false">http://blog.kamens.brookline.ma.us/~jik/wordpress/?p=1208</guid>
		<description><![CDATA[I am an email pack-rat.  I have saved just about every email message I&#8217;ve sent or received at work or at home in the past twenty years (excluding messages sent to public mailing lists).  That&#8217;s a lot of email, over 400,000 messages. I don&#8217;t just do this for the heck of it.  I look for [...]]]></description>
			<content:encoded><![CDATA[<p>I am an email pack-rat.  I have saved just about every email message I&#8217;ve sent or received at work or at home in the past twenty years (excluding messages sent to public mailing lists).  That&#8217;s a <em>lot</em> of email, over 400,000 messages.</p>
<p>I don&#8217;t just do this for the heck of it.  I look for things in my archived email on a regular basis.  Most of the time I&#8217;m only looking back a few months or perhaps a couple of years, but I do occasionally find it necessary for one reason or another to go digging through the really old stuff.  To make that feasible,  I need to be able to quickly search hundreds of thousands of messages.</p>
<p>Over the years I have imposed a lot of requirements on acceptable solutions for this problem:</p>
<ul>
<li>I want to be able to store the email in a compressed form, so the search engine needs to understand how to decompress the email archives when indexing or retrieving messages from them.</li>
<li>To achieve decent compression, the email has to be stored in files that hold multiple messages, rather than storing each message in its own file.  Therefore, the search engine needs to understand how to break up the mailbox files into separate messages, index them separately, and retrieve them separately during searches.</li>
<li>I don&#8217;t want to use a proprietary or binary mailbox format &#8212; I want to be able to look at the mailboxes in a text editor and manipulate them easily with tools such as Perl.  I used to store my email in <a href="http://quimby.gnus.org/notes/BABYL" target="_blank">BABYL Files</a>, but now I use <a href="http://en.wikipedia.org/wiki/Mbox" target="_blank">mbox format</a> (which <a href="http://www.mozillamessaging.com/en-US/thunderbird/" target="_blank">Thunderbird</a> and <a href="http://www.eudora.com/" target="_blank">Eudora</a> also use for local folders).</li>
<li>I don&#8217;t want to be locked into a GUI &#8212; I need to be able to update the index, do searches, and retrieve results through the command line.</li>
</ul>
<p>For many years, I was unable to find any actively maintained open-source software package that satisfied all of these requirements.  I was therefore stuck using freeWAIS 0.5, one of the very first Internet search engines, which was developed and released by Thinking Machines Corporation over 20 years ago.  I was an active developer on the project; my efforts were focused on making the indexing code faster and less of a disk-hog and fixing a myriad of bugs and memory leaks (freeWAIS was written in C; its primary authors, all of them Lisp programmers, were so used to automatic garbage collection that they were very bad about cleaning up after themselves).  Every since the freeWAIS project went defunct, I&#8217;ve maintained my own personal version of the code, layering hack on top of hack to keep it compiling and running on new versions of Linux.  It was gross, but it was good enough.</p>
<p>That is, it was good enough until I upgraded my Linux box at home about a month ago and went from 32-bit Linux to 64-bit Linux.  The freeWAIS code is <em>very</em> dependent on things like the size of an integer, the size of &#8220;time_t&#8221; and &#8220;off_t&#8221;, etc.  Furthermore, to say that the code is not particularly clean or portable would be a gross understatement.  When I rebuilt it for 64-bit, it stopped working.  After spending several hours trying unsuccessfully to yet again nurse it back to health, I decided to take another look around to see if any new search engines that would do what I need had come onto the scene.</p>
<p>I was delighted to discover <a href="http://www.rpcurnow.force9.co.uk/mairix/" target="_blank">mairix</a>, a package written and maintained by <a href="http://www.rc0.org.uk/" target="_blank">Richard Curnow</a> which bills itself as &#8220;a program for indexing and searching email messages stored in maildir, MH or mbox folders.&#8221;  Wow, someone went and wrote exactly the tool I needed.  w00t!</p>
<p>Well, actually, it&#8217;s not <em>exactly</em> the tool I needed, because when I set it up last night I discovered some minor issues with its parsing of mbox files.  But I fixed those issues and sent Richard my patches, and I hope they&#8217;ll be incorporated into the next release so I don&#8217;t have to go down the maintain-my-own-software road again <img src='http://blog.kamens.us/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> .  (If you&#8217;re trying to use version 0.21 of mairix to index mbox files, <a href="mailto:jik@kamens.brookline.ma.us" target="_blank">email me</a> and I&#8217;ll send you my patches.)</p>
<p>Mairix indexed my &gt;400,000 email messages in 12 minutes (3.5GHz CPU, 7,200 RPM SATA hard drive).  The mairix index consumes only 144MB of space, despite the fact that my email archives take up 1.1GB <em>compressed.</em> It takes mairix <em>less than 0.2 seconds</em> to do an AND search for two search terms and save the 8 matching messages into an mbox.  That is simply incredible.</p>
<p>One of the ways Richard made mairix so fast is by using another tool he wrote, <a href="http://www.rpcurnow.force9.co.uk/dfasyn/index.html" target="_blank">dfasyn</a>, which he describes as &#8220;a tool for building general deterministic finite automata (DFAs) given a description as a non-deterministic finite automaton.&#8221;  You use a high-level syntax to describe the various legal state transitions, and dfasyn compiles that into some big numeric arrays and a very trivial function which transitions between machine states using nothing but pointer and integer arithmetic.  The nerd in me thinks this is <em>très </em>cool.</p>
<p>I&#8217;m posting about mairix both to let other people know about this great tool, and to give Richard the kudos he deserves for implementing it.</p>
<p>Share and enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.kamens.us/2010/01/08/my-new-favorite-open-source-software-mairix-by-richard-curnow/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
