Custom Search Engine

Google's custom search engines are a powerful way to create flexible dynamic and free search engines for sites.

Here is a good article of how to create on - blogoscoped.com

# Components

A custom search engine has two main components, each of which is controlled by an XML file: * __Context__: The Context XML File describes the basic features of a search engine. Each search engine has its own context file. * __Annotations__: The Annotations XML File lists the webpages or websites you want your search engine to cover, and indicates any preferences you have about how these sites should be ranked in your search results. Each site and its associated information is called an annotation.

When you download annotations from the CSE Control Panel, you will get a single cse.xml annotations file that combines all the annotations from different search engines in your account. The format of this merged file is of the same form as inline annotations.

These two files can be separate, or combined into a single "inline" XML file that looks like:

<GoogleCustomizations> <CustomSearchEngine> <Context> <BackgroundLabels> <Label name="_cse_solar_example" mode="FILTER"/> </BackgroundLabels> </Context> </CustomSearchEngine> <Annotations> <!--Include this site in the search results--> <Annotation about="http://www.solarenergy.org/*"> <Label name="_cse_solar_example"/> </Annotation> <!--Include this site in the search results--> <Annotation about="http://www.solarfacts.net/*"> <Label name="_cse_solar_example"/> </Annotation> </Annotations> </GoogleCustomizations>

You can create an annotations file for each context file or you can have a single annotations file shared by all your search engines.

# Hack Don't Create

Google doesn't recommend that you create either of these files from scratch. Instead, download them from the Advanced tab of the Control Panel .

# Additional Components

In addition to these main components, a search engine can also have the following auxiliary files: * __Promotions__: The promotions XML file lists a series of custom results that are triggered by a pre-defined set of query terms. When a user types a search that exactly matches one of your query terms, the promotion appears at the top of the page. You can use promotions to directly answer the queries of your users, lead them to important information, or point them to webpages that are not at the top of the results page yet are especially relevant. In the Control Panel, promotions are defined in the Promotions tab. More information about promotions. * __Synonyms__: The synonyms XML file expands the queries of your users to include variants of the search term. For example, if your user searches for "simian," the search engine also searches for "monkey" and "ape." In the Control Panel, synonyms are defined in the Synonyms tab. More information about synonyms.

# See also