MUniversity of Minnesota

April 25, 2006

How do I put a search engine onto my blog?

Hello everyone! I'm still working on the technical FAQ, but in the meantime I thought I would give you some instructions on how to put a search engine on your blog. As many of you have already found out, the search tool that comes with Movable Type is woefully inadequate. In fact, it is just pathetic, especially when you are searching a database of the size that is UThink (as of 4/25/06 over 36,000 individual entries). It is for this reason that I have removed the search box from all new blogs and their corresponding templates. Searches were taking upwards of a minute to complete. Obviously, this is unacceptable.

There is an answer to our problem, however. Google actually does a very good job of indexing UThink content (a phenomenal job, truth be told) and it is possible to use Google to put a search box back on your blog. In fact, we can even use the U of M Google Search Appliance as our search engine, and you can even limit your search to the contents of your blog only. How do you do it?!?!? Well, just read on!

  1. Login to UThink and enter the blog you want to add a search box to.
  2. Click on "Templates" in the left hand menu and then click on the "Main Index" template.
  3. Look for the line that starts "<div id="beta">". It may be a little difficult to find, but it should be towards the middle of the template. When you find that line, add these lines right underneath it:

    <div id="beta-inner" class="pkg">
    <div class="module-search module">
    <h2 class="module-header">Search</h2>
    <div class="module-content">
    <form method="get" action="http://www.google.com/u/umn">
    <input id="search" name="q" size="20" /><br />
    <input type="hidden" name="domains" value="<$MTBlogURL$>" />
    <input type="hidden" name="sitesearch" value="<$MTBlogURL$>" />
    <input type="submit" value="Search" />
    </div>
    </div>

Save the template and rebuild it. Then try a search. It should be able to find entries that have been indexed by the U of M Google Search Appliance. Of course, it will not be able to find entries that you have just written, but that should be OK since those entries are probably still on your blog home page.

Give it a try and let me know what you think. If this works well I may just put this in the default templates for all new blogs. Happy searching!

(PS -- These instructions apply to blogs created with MT 3.2 templates (all new blogs). If you have a blog older than November 2005, I can provide you with alternate instructions. Just let me know!)

Posted by snackeru at April 25, 2006 03:00 PM
Comments

Thanks, the search box works quite well! I like it.

Posted by: Kamran at May 2, 2006 09:44 PM

Thanks Shane! Works like a charm. Keep up the good work! (Dog-gone spammers!)

Posted by: DouglasG at May 11, 2006 02:30 PM
Post a comment









Remember personal info?