After looking at the ever-expanding collection of Google Modules, seeing they are just little (or not so little) chunks of XML, I began getting the urge to tinker, to see how complicated it would be to write my own GM.
I started with a scan of Google’s thorough Homepage API – Developer Docs, which showed that a Hello World example was easy, and things grew incrementally, then geometrically more complex form there. But not so bad.
So thinking about what might be semi-useful, I aimed for a module that would allow me to quickly do a keyword search on any WordPress blog, but most likely my own. This is pretty easy to do, and I have already created a tool for doing this via a browser bookmarklet.
The concept is pretty simple, if you are searching for the keywords moon cheese on Wallace’s WP blog at (this is a fake URL) http://www.wallace.co.uk/blog/, the correct URL to construct to create this search is simple http://www.wallace.co.uk/blog/index.php?s=moon+cheese.
It took a bit more tinkering than I thought, and the visual display is plain, but in use the Module looks like:
The default settings are to search this blog (handy for me, eh?). So from this module, I would click “go” and get the same results as a search from my blog sidebar.
But wait, there is more. If I click “edit”, I can change the preferences to ones where I can make it search another WP blog, for example, Alec Courous’s blog:
And once I save it, my Google home page is a quick search for Alec’s blog:
You can find my new Google Module at:
and it is as simple as:
<?xml version="1.0" encoding="UTF-8" ?>
title=" __UP_wpname__ WordPress Blog Search"
description="Do a keyword search of any WordPress Blog"
author="Alan Levine" author_email="firstname.lastname@example.org"
author_affiliation="CogDogBlog" author_location="Phoenix, Arizona" />
<UserPref name="wpblog" display_name="Blog URL (must end in '/')"
<UserPref name="wpname" display_name="Blog Name" default_value="CogDogBlog" />
<form action="__UP_wpblog__index.php" method="get" target="_blank">
<input type="text" input name="s" size="20" value="">
<input value="Go" type="submit">
This is just a quick dip into the coding pool. It is dependent on getting the blog URL correct (must end in the trailing “/”) of the blog home. It failed to work on D’Arcy Norman’ site (maybe something to do with his Livesearch query method). It would be even better to have it allow me to create a list of WP blogs that I could choose one with a radio button to direct the search.
Again, this was a project born of Idle Curiosity. It has some use, as I prefer to search my blog without having to load the entire home page juts to get to a single form.
But this is pretty simple (way below “rocket science”, it is as complex as “jello science” or “top ramen science”), and there is a rich amount of complexity built into this system that could allow creation of some fascinating tools, and truly is Small Technologies Loosely Joined (by XML), and pulled together by some Googly AJAX. It’s something I will keep in my hat as I think of other ways to provide these plug and play web tool-ets.
The post "Google Module: WordPress Search" was originally pulled like taffy through a needle's eye at CogDogBlog (http://cogdogblog.com/2005/12/google-module-wordpress-search/) on December 28, 2005.