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!
- Login to UThink and enter the blog you want to add a search box to.
- Click on "Templates" in the left hand menu and then click on the "Main Index" template.
- 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">
<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" />
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