dive into mark

You are here: dive into markArchivesAugust 2002New and improved site search

Wednesday, August 14, 2002

New and improved site search

At the behest of Simon Willison, and with the help of Brad Choate (who apparently can debug Perl code in his head), I am now using a customized version of MT-Search 1.31b to power my very own site search. I had previously complained that MT-Search was too slow searching my 900+ entries, but all performance problems have been magically resolved after upgrading to Movable Type 2.2 and MySQL. This also solves the problem of the Google gap (which Simon rightly complained about), whereby content would fall off the home page and disappear into the ether for three weeks until Google got around to reindexing it.

Update: search results are now available as RSS by adding Template=rss to the URL. (Inspired by Rael Dornfest.) This means that, if you’re interested in a topic for which I don’t have a category-specific feed, you can go create your own custom RSS feed based on search terms. If you only wanted to read my posts about Movable Type, you could create a custom Movable Type feed. Or you could exclude posts, by using the keyword NOT in your search. (More examples of search syntax.)

Of course, this also opens the door for an entirely new type of online vanity: custom RSS feeds that mention you by name. Example: a custom Dean Allen feed. Not that Dean Allen is vain. We love Dean. And his dog, Oliver. As you can tell from the Oliver feed.

So how do you do it?

  1. First, install MT-search.

  2. Save the rss.tmpl template in your mt/search_templates/ directory.

  3. In your mt-search.cfg, add this line:

    AltTemplate1 rss rss.tmpl

  4. Also if you’re using MT-Search 1.31b (the latest version at the moment), you’ll also need to patch the source code to fix some bugs. Around line 37 of SearchTemplate.pm, at the top of the _hdlr_results function, add this line:

    my $output = '';

    This fixes a bug that would otherwise prevent using multiple <MTSearchResults> tags per template. As always, thanks to Brad Choate for his help in tracking this down and fixing it.

Filed under , , ,

Respond privately

I am no longer accepting public comments on this post, but you can use this form to contact me privately. (Your message will not be published.)



Recent Stuff For You, Special Price Stay Here
  • Greasemonkey Hacks
Good Stuff Buy The Cow Go Away
Dive Into Python
Powered by Google Drink The Milk Don't Steal

 

posts / comments
© 2001-8 Mark Pilgrim