Topics Map > University of Chicago > IT Services > Services & Support > Web Development/Hosting/Resources

Google Search Appliance - Add a Google Search to your Website

This article explains how to add a standard UChicago search or a customized search to your website.

The University of Chicago uses a Google Search Appliance (GSA) as the main search tool for public web-based content. The Appliance continually indexes new documents as they are posted to the University of Chicago websites, and guides users to relevant content using customized search results. The GSA uses the same technology as Google.com: it's a locally run instance of Google focused exclusively on the University of Chicago.

Adding a Standard UChicago Search

Adding a standard UChicago appliance-powered site search is simple. Just place the following XHTML code where you want the search form to appear:

<form method="get" action="http://search.uchicago.edu/search"> <input type="text" name="q" maxlength="256" id="searchbox" value="Search&#8230;" onfocus="if(this.value=='Search&#8230;')value=''" onblur="if(this.value=='')value='Search&#8230;';" /> <input type="submit" name="btnG" value="Search" /> <input type="hidden" name="site" value="default_collection" /> <input type="hidden" name="client" value="default_frontend" /> <input type="hidden" name="output" value="xml_no_dtd" /> <input type="hidden" name="proxystylesheet" value="default_frontend" /> <input type="hidden" name="oe" value="utf8" /> <input type="hidden" name="ie" value="utf8" /> </form>

This code will create a form that searches all public UChicago websites and looks like the following example:

Adding a Customized Search

To create a search form that limits results to your site, or allows a user to select a radio button to choose between a site-specific and UChicago-wide search, use the code examples below.

Limit results to your site:

Note: Replace "your_site_url" with the URL of your site in the sitesearch input field.

  • Use "oi.uchicago.edu" as the sitesearch value to limit the search results to the Oriental Institute site
  • Use "oi.uchicago.edu/research" as the sitesearch value to limit results to the research directory and *include* subdirectories
  • Use "oi.uchicago.edu/research/" to limit results to the research directory and *exclude* subdirectories
  • Note: do not include the protocol (http://) in the sitesearch value (ex: use "oi.uchicago.edu", not "http://oi.uchicago.edu")

<form method="get" action="http://search.uchicago.edu/search"> <input type="text" name="q" id="searchbox" value="Search&#8230;" onfocus="if(this.value=='Search&#8230;')value=''" onblur="if(this.value=='')value='Search&#8230;';" /> <input type="submit" name="btnG" value="Search" /> <input type="hidden" name="site" value="default_collection" /> <input type="hidden" name="client" value="default_frontend" /> <input type="hidden" name="output" value="xml_no_dtd" /> <input type="hidden" name="proxystylesheet" value="default_frontend" /> <input type="hidden" name="sitesearch" value="your_site_url" /> <input type="hidden" name="oe" value="utf8" /> <input type="hidden" name="ie" value="utf8" /> </form>

This code will create a form that searches only the specified site and looks like the following example (oi.uchicago.edu used as an example):

Radio button limits search results:

Note: Replace "your_site_url" with the URL of your site in the sitesearch input and "Your site" with the correct label for your site.

<form method="get" action="http://search.uchicago.edu/search"> <input type="text" name="q" id="searchbox" value="Search&#8230;" onfocus="if(this.value=='Search&#8230;')value=''" onblur="if(this.value=='')value='Search&#8230;';" /> <input type="submit" name="btnG" value="Search" /> <input type="hidden" name="site" value="default_collection" /> <input type="hidden" name="client" value="default_frontend" /> <input type="hidden" name="output" value="xml_no_dtd" /> <input type="hidden" name="proxystylesheet" value="default_frontend" /> <input type="hidden" name="oe" value="utf8" /> <input type="hidden" name="ie" value="utf8" /> <!-- radios for sites --> <br /> <label for="local"><input id="local" type="radio" name="sitesearch" value="your_site_url" checked="checked" /> Your site</label>&nbsp;&nbsp;<label for="all"><input id="all" type="radio" name="sitesearch" value="" /> UChicago</label> </form>

This code will create a form that uses a radio button selection to search either UChicago websites or the specified site, and looks like the following example (oi.uchicago.edu site used as an example):

XML-formatted search results:

To return raw XML-formatted search results, simply change the "output" input in any of the search code examples above from

<input type="hidden" name="output" value="xml_no_dtd" />

to

<input type="hidden" name="output" value="xml" />

For more information about search customization, see Google's extensive Search Protocol Reference.

The GSA is managed by the Web Services and Web Administration groups within IT Services. If you have a question or issue with implementing a GSA-powered search form, please contact us at search@lists.uchicago.edu.

External Resources




Keywords:gsa, custom, indexing, crawl, customized, radio, button   Doc ID:15762
Owner:Alan T.Group:University of Chicago
Created:2010-11-28 19:00 CDTUpdated:2017-04-04 10:20 CDT
Sites:University of Chicago, University of Chicago - Sandbox
Feedback:  1   0