[Mailman-Users] Adding Namazu search to Mailman archives

Tom Morrison t.morrison at liant.com
Fri Jun 25 16:45:23 CEST 2004

The following may be useful.  I chose this technique because it was least
invasive on a stable Mailman configuration.  My Mailman lists do not have
heavy usage -- only about 20 messages/day -- so YMMV.

Best regards,
Tom Morrison
Liant Software Corporation


Adding Namazu search capability to Mailman archives (Linux).

Download Namazu source (http://www.namazu.org/index.html.en) and install it.
Be sure that the pipermail.pl filter is installed.  I created a user account
(nmz) in which to store the indexes for multiple lists, and also as an
account to use to run cron periodically to reindex the archives.  The
structure of this account's directory was simply:
where list1, list2, ... listn are the Mailman %(listname)s values for all
the lists that you wish to index.  

Copy all the NMZ.{head,foot,body,tips,result.normal,result.short} files into
each list's directory and customize them as needed for each list.  (This is
a tedious bit, but since Namazu and Mailman are not very cognizant of each
other, I didn't find any easy, template-driven way around this.  mknmz
rewrites all the NMZ.* head/foot files in place each time it rebuilds the

Create a shell script in the Namazu user account to run an index for each
mailing list; e.g.:
	mknmz -O list1 \
		 --media-type='text/html; x-type=pipermail' \
		 --template-dir=list1 \
	mknmz -O list2 \
		 --media-type='text/html; x-type=pipermail' \
		 --template-dir=list2 \
	mknmz -O listn \
		 --media-type='text/html; x-type=pipermail' \
		 --template-dir=listn \

Run the shell script to create the indexes.

Create a directory for each list in the mailman/cgi-bin directory.  

Copy namazu.cgi into each mailman/cgi-bin/listi directory.  

Copy namazurc-sample to .namazurc in each mailman/cgi-bin/listi directory.

Edit .namazurc to have Index point to the Namazu account's home directory
(e.g. /home/nmz), and to have Template point to the appropriate index
directory in the Namazu account's home directory (e.g. /home/nmz/listi).

Set up a crontab entry for the nmz account periodically to run the shell

Edit the Mailman archive templates to add the search form used to invoke
namazu.cgi.  I added the following to archtoc.html:
<form method="get" action="/mailman/%(listname)s/namazu.cgi">
<p><strong>Search String:</strong>
<input type="text" name="query" size="40">
<input type="submit" name="submit" value="Search!">
<input type="hidden" name="idxname" value="%(listname)s">
<a href="/mailman/namazu.cgi?idxname=%(listname)s">[How to search]</a><br>
<select name="max">
<option value="10">10</option>
<option selected value="20">20</option>
<option value="30">30</option>
<option value="50">50</option>
<option value="100">100</option>
<select name="result">
<option selected value="normal">normal</option>
<option value="short">short</option>
<select name="sort">
<option selected value="score">by score</option>
<option value="date:late">in reverse chronological order</option>
<option value="date:early">in chronological order</option>
<option value="field:subject:ascending">by title in ascending order</option>
<option value="field:subject:descending">by title in descending
<option value="field:from:ascending">by author in ascending order</option>
<option value="field:from:descending">by author in descending order</option>
<option value="field:size:ascending">by size in ascending order</option>
<option value="field:size:descending">by size in descending order</option>
<option value="field:uri:ascending">by URI in ascending order</option>
<option value="field:uri:descending">by URI in descending order</option>

Finally, use 'bin/mailman restart' to restart Mailman, causing Mailman to
reload its cached html templates.

More information about the Mailman-Users mailing list