Refining Your Search Engine

Now that you have the context and annotation files on your system, there are several ways in which you can refine your search engine. First I'll show you how to personalize your engine by changing the colors on the resulting page.

I made the changes shown below to the downloaded context file. These set the color of the background of the results pages, the border that goes around Google advertisements, and the title at the top of each search result returned.

I can then go back to the Advanced tab in the control panel for my search engine and upload this new file (remembering to first save a copy of the original file). Immediately after the upload has completed, I can use the Preview tab to see what the changes look like.

Here are the various color parameters that can be set and what they change on the search engine results page.

Parameter

Defines color for

Background

Background for the results page

Border

Border drawn around advertisements and above results

Title

Title of the URL above each search result

Text

Text shown for each search result

URL

Non-working URL shown below each search result

Visited

Title URL after it has been visited

Light

Other information beside URL. Cached or refinement labels

By making changes to the annotations file you really control the heart of your search engine. As well as defining more sites to include, you can also specify categories for each site and given them a higher or lower priority.

Google calls the categories Refinements. These appear at the top of the results page and are used to focus in on a set of the total results. For the Diabetes Search Engine the results page has several of these including symptoms, complications, and research.

Figure 7. Refinements

You can see that each result is displayed with a set of labels indicating how it was categorized. And by clicking on one of the label hyperlinks, the results for sites with that label only are returned.

To create a refinement, you must first modify the context file to specify the label names that will appear on the results page.

I've defined two different labels that can be assigned to each site in the search engine. When the Lunch hyperlink is clicked, all sites with this label assigned have their priority boosted so they appear closer to the top of the search results. In this case, unlabeled sites can also appear in the results. We could boost by a larger amount (up to 1) to emphasize them even more.

When the Dinner one is chosen, only sites that are labeled with the Dinner refinement will appear in the results. All others, including unlabelled sites, will not be shown.

Now that we have some refinements, I can change the annotations file to assign these labels to the sites that I want. Each site is already defined in an <Annotation> node, and I simply add new <Label> nodes for each refinement that I want to assign.

Conclusion

This article is intended to provide you with enough of an introduction to Google Custom Search Engines that you can create one of your own. This will give you a chance to use your expertise in a specific area to assist people who are looking for answers or help in that area. The detail on the advanced topics will also allow you to customize the data your engine returns and how it's presented to people.

Bernard Farrell
is a software architect focusing on user experience issues. He has over 30 years experience in software design and development including user interfaces for early workstations. He created the diabetes search engine and write a blog about diabetes technology.