In case it’s useful to anyone, I wrote a quick proof of concept for doing search with mailman lists (code after the break).

The background is - I subscribed to a mailing list and shortly thereafter there was a call for feedback posted. One of the points was:

“We’re looking specifically for systems that offer strong search and archiving features, to help manage the wealth of knowledge that [redacted] generates. What other specific functionality should we look for in a new platform?”

This is a closed list so google doesn’t pick up and index the archives.

There was a lot of discussion and it seemed to me that most people really were fine with status quo but wanted to add search.

I was surprised that noone’s done a quick and dirty search hack - the search integrations that are out there are relatively more complex to integrate, though less cumbersome than porting a Unix utility from one variant to another was in the 90s…

I despite posting the code, a demo of it, and an offer to integrate it (I don’t run any mailman sites myself), but…

It turns out that the bigger issue was probably the list/group runners’ wanting to outsource the whole thing and not have volunteers need to maintain things.

So everything’s the same a few months later (though they may move to discourse eventually, which looks awesome).

So in case it’s useful to anyone, the code is below.

Feel free to ping me as I’d be open, depending on my schedule, to moving it from proof of concept to nasty but integrated little hack.

Note - this just operates on a bunch of articles retrieved with wget and put into a directory. Indexing could be done without too much difficulty, but for low search volume, especially on a closed list, it shouldn’t be a problem.

{% codeblock %}

!/usr/bin/perl

use CGI qw(:standard);

my $searchstr = param(‘search’); my $globalfound = 0;

print “Content-type: text/html\n\n”;

$searchstr =~ s/[\W]//g;

print ” Quick Search Test “;

if (length($searchstr) < 3) { print “

Sorry, your search request ($searchstr) is too short.

“;

exit(0); }

print “

Search Request:

You asked to search for $searchstr

Search Results:

";

foreach $file ()
{
  my $inbody = 0;
  my $matches = 0;
  my $base = "";
  my $title = "";
  my $date = "";
  my $from = "";

  open(IN, $file);
  while ()
  {
    if (//) { $base = $1; }
    if (/ (.*)/) { $title = $1; }
    if (/<I>(.*20.*)<\/I>/) { $date = $1 ; }
    if (!/Messages so/ && /<B>(.*)<\/B>/) { $from = $1; }

    if (/^\<\!\-\-beginarticle/) 
    { 
      $inbody = 1; 
    }
    else
    {
      if ($inbody)
      {
        if (/^\<\!\-\-endarticle/)
        { 
          $inbody = 0; 
        }
        else
        {
          if (index($_, $searchstr)> -1)
          {
            $matches = 1;
          }
        }
      }
    }
  }
  close(IN);

  if ($matches) 
  { 
    $globalfound++;

    print "[$date] <a href=\"$base\"><b>$title</b> ($from)</a>\n"; 
  }
}

if ($globalfound == 0)
{
  print "Sorry, no matching articles found.\n";
}

print "
</pre>

<p></body>
</html>
“;</p>

<p>exit; 
{% endcodeblock %}</p>
</div>
    
</div>




    <div>
        <hr />
        
            <p>Next post: <a href="http://avi.net/2013-10-22-future-blog-topics-slash-thoughts-will-take-requests.html">“Future Blog Topics/Thoughts (will take requests)”</a></p>
        
        
            <p>Previous post: <a href="http://avi.net/2013-08-12-make-mistakes-fast.html">Making Mistakes Fast</a></p>
        
    </div>

    






        </div>
        <div class="col-sm-3 sidebar">
            <section>
                <h1>Hello</h1>
                <p>
                    This is a blog by <a href="mailto:avi@avi.net">Avi Freedman</a>.
                </p>
            </section>
            <section>
                <h1>Search</h1>
                <form action="https://duckduckgo.com" method="get">
                <input name="q" type="text" placeholder="Search this blog" />
                <input name="sites" type="hidden" value="http://avi.net/" />
                <input type="submit" value="Go" />
                </form>
            </section>
            <section>
                <h1>Recent Posts</h1>
                <ul>
                
                    <li><a href="http://avi.net/2013-10-22-future-blog-topics-slash-thoughts-will-take-requests.html">“Future Blog Topics/Thoughts (will take requests)”</a></li>
                
                    <li><a href="http://avi.net/2013-08-17-quick-mailman-search.html">Quick Mailman Search</a></li>
                
                    <li><a href="http://avi.net/2013-08-12-make-mistakes-fast.html">Making Mistakes Fast</a></li>
                
                    <li><a href="http://avi.net/2013-07-23-ipad-mini-keyboards-quick-review.html">Zagg iPad Mini Keyboard Quick Review</a></li>
                
                    <li><a href="http://avi.net/2011-01-21-network-budgeting.html">Does Squeezing Network Costs Cut Revenue?</a></li>
                
                    <li><a href="http://avi.net/2011-01-20-teaching.html">Teaching Others for Fun and (Likely) Profit</a></li>
                
                    <li><a href="http://avi.net/2010-09-09-new-diablo-overview-system.html">New Diablo Header System</a></li>
                
                    <li><a href="http://avi.net/2010-09-05-sprint-epic-4g-is-great.html">Sprint Epic 4G is Great!</a></li>
                
                    <li><a href="http://avi.net/2010-09-01-lenovo-x21s-is-a-no.html">Lenovo x21s is a No</a></li>
                
                    <li><a href="http://avi.net/2010-09-01-new-site.html">New freedman.net Site, Based on Jekyll</a></li>
                
                </ul>
            </section>
        </div>
    </div>
     <footer style="font-size:small; font-style:italic" class="container">
        <hr />
        <p>Powered by <a href="http://jmac.org/plerd">Plerd</a>.</p>
        </footer>
    </div>

    <script type="text/javascript" src="https://code.jquery.com/jquery.js"></script>
    <script type="text/javascript" src="https://netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
    </body>
</html>













<style>
/* img.media-object { max-width: 64px } */
</style>