How to Build a Google Custom Search Engine

Article main image
Jun 9, 2011
This article is part of a series called Q/A.

Custom search engines (CSE’s) may seem like a tool for advanced users — but in fact anyone can build one, even not knowing much about advanced Boolean operators. If you have never built a CSE, start with this: Create a Custom Search Engine on the fly. All you need is to input a site you’d like to search, such as your own website, or any site you like.

Let’s try, for example. You can ignore the “code” section on the left – just go ahead and use your engine. Let’s try a search for “Vice president of business development.”

…This feels like magic, doesn’t it?

The Control Panel

Now let’s try to create something a bit more sophisticated. The start page allows you to specify the name of your engine, a description, and sites to search. Interestingly, you can include a template for your search using the asterisk *. (Note that the use of the asterisk in Google’s search engine is totally unrelated.)

Here’s an example: you can use the site templates *.gov and *.com – and your custom engine will search only in those domains. Or, you can use and (sound familiar?). After you’ve added some sites, skip the “code” and the look-and-feel editing for now, and get back to the basics/control panel to add even more adjustments.


On the basics page you can provide the “search engine keywords.” These will guide your CSE to bring pages with these words higher up in the list of results; pages without the words will be included, too.


The Control panel/Sites section lets you add and remove sites that will show up in the search results. To continue our exercise, let’s build a LinkedIn/USA profile search engine. This list of sites will give us a good start:

(Click on the image to try the engine)

By now we have learned how to include and to exclude sites, and to add keywords to help rank relevant pages higher. One last power hint for beginners is to define the “refinements.”


A refinement makes your CSE automatically add your specified search substring to the search string that your user types.

As an example, create refinements with the strings filetype:pdf and filetype:doc, and your search engine will have options to search for files with the given type:

…These are the core capabilities of CSE’s, as I see them. Using the lists of sites and the refinements you can create truly powerful custom search engines. In fact, I’d say that with careful and creative use of these CSE building tips you should be able to build a super-CSE — and win the SourceCon Challenge!

Hints for CSE Users

To make your CSE’s easier and nicer to use, here are a couple of hints for both CSE creators and users.

  1. Add &num=100 to the search URL to see 100 results per page.
  2. Add &tbs=qdr:y to the search URL and your CSE will show a date range; as an example, try my Document Finder with the date range added.

Beyond the Basics

If you are still hungry for more technical stuff, here is a brief description of a few additional ways to enhance your CSE’s. To learn even more, read the documentation and experiment.

(By the way the mysterious “code” section that we’ve ignored for now is the HTML code for including the CSE on your own site. You don’t need it to share the engine with others — simply providing its URL will work.)

Here are some advanced hints:

  1. Use the synonyms to pick similar words as you see them fit. You can even create secret phrases or letter combinations to trigger special searches. Mike Notaro was able to force a CSE to look for the @ sign in some cases; you can’t expect to do a whole lot on this path though.
  2. Use the site templates to include sites defined by a pattern that are not possible to specify with the Google’s “site:” operator. This is a rich area to explore! I was experimenting and included some special characters in the template, forcing my CSE to (partially) search the Deep Web:
  3. Advanced users can save, edit, and upload XML files with lists of sites and the CSE parameters. You can edit these files to apply “weights” to sites to search, taking control of ranking. (You can make your site appear first in any search, for example, if you are so inclined).

Have fun building your CSE’s!

This article is part of a series called Q/A.
Get articles like this
in your inbox
The original publication for Sourcers, delivered weekly.