Docstoc

Tailoring Google Site Search (DOC download)

Document Sample
Tailoring Google Site Search (DOC download) Powered By Docstoc
					Tailoring Google Site Search

Step 1: Provide basic information
       Search engine name - Descriptive name that could give people ideas about the type of search engine you are
        building. The name appears on your custom search engine homepage that Google hosts and the search results
        page that Google serves.
       Search engine description - Brief information about your custom search engine, such as what it searches and
        who might be interested in using it. The description appears on your custom search engine homepage and
        results page.
       Search engine keywords - Keywords are a quick way of boosting certain webpages in your search results and
        getting more search results about the subject. You can add as many keywords as you want, as long as you don't
        exceed 100 characters.
       Search engine language - The language of the interface of the search engine, such as the search box button.
       Search engine encoding - The text format of the search results. This setting must match the encoding of your
        webpage. In vast majority of cases, Unicode (UTF-8) is the best option.

Step 2: Create labels for refining & restricting the search
Refinements labels are a way for you to categorize sites by topics. For example, at the English subject Centre we have
Events, Projects, Publications, Colleagues, and so on . You can create refinement labels that you associate with the sites
you listed in your Google account. The refinement links appear at the top of your search results page, and users can click
them to narrow down their searches. A search page can have as many as 16 refinement links.

Step 3: Define the look and feel
There are a few ways to change the look and feel of your search engine.

       Use the tools within Google Site Search - The simplest option. Just add a logo and use the web interface to
        choose your look and feel then copy the code for the search box and insert it in every page where you want a
        Custom Search box.
       Manually change the XML – Alternatively you can define your look and feel in the Context.xml file that you
        submit to Google.




1
Below is a sample Context.xml that would be submitted to Google.




2
Step4: Define the scope of your search engine
You can add sites (or url patterns) one at a time to your Custom Search Engine in the control panel of your Custom
Search Engine or with the Google Marker. If you would like to add a large group of websites to a search engine, all at
once, you can also upload a separate XML file with a list of annotations.

Another reason for uploading annotations in a separate XML file formats is that you can also associate scores with url
patterns, a feature not currently available in the control panel or the Google Marker. These scores can be used to
control the ranking of search results.

Here is an example of Annotation.xml that gets submitted to Google to define the search domain.




3
Step 5: Write code to use Google API
This step is required if you are using the XML API that Google exposes. The solution involves making a request to the
Google server and getting the response, extracting the search result from the response and displaying the search result
on the screen.

Here at the English Subject Centre we have built several modules that take care of each of these tasks.

                   A search form that contains all the UI elements and is the interface between the system and the user.
                   Search Request class that encapsulates all the information about the HTTP request that gets sent to
                    Google.
                   An XML Parser that parses the response after it is returned by Google.
                   A Search Result class that encapsulates information about each search result.

Below is a Sequence diagram that shows how above modules interact with one another


                                            Search Form                       Search Request       Google API   XML Parser          Search Result


           : User
                     Search (Search term)
                                                              Create()


                                                          Make Request(Request)

                                                                         XML


                                                                 Parse(XML)
                                                                                                                             Create()

                                                                                  Search Results


                                                     Display Results

                           Return




A sample search life cycle

    1. User types in a search term and clicks on Search button.

    2. A ‘Search Request’ object is created that encapsulates all the data about the request e.g. HTML request headers.

    3. System makes the request to the Google API and waits for the result.

    4. System receives the result as XML.


4
    5. System calls the ‘XML Parser’ to parse the XML.

    6. ‘XML Parser’ creates a list of ‘Search Result’ objects while parsing the XML.

    7. ‘XML Parser’ returns back the list of search results.

    8. System display the search results.




5

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:3
posted:4/9/2012
language:English
pages:5