IRT Logo

Adding a search field to your page

New School of Medicine sites come with a custom search box in the upper right corner. The following may be useful for sites outside of the Stanford format, or where other search options are needed.

About Google

Stanford moved from Ultraseek to Google technology and retired the Ultraseek engine at the end of Summer, 2003. Stanford is upgrading the Stanford Google appliance to version 4 and the search domain "ask.stanford.edu" now, and will depreciate the older "find.stanford.edu" search domain as of Sept. 14, 2006. After this time, searches using "find.stanford.edu" will break. Read More >

The following information documents the use of the Stanford Google search technology. If you need to take control of a School of Medicine site's development, or if you need help setting up the new search box, contact Web Help .

Using Stanford Search on your site

You can set up a search field to pull results for your site from the Stanford Search index, the one used by the Search field of the main Stanford Home page. Before adding Search capabilities to your site, it's a good idea to make sure your pages are set up to produce good results in search engines. Any files you want to be searched should have:

  • A unique and informative browser title: Each page's browser title should be different from those of other pages and reflect the content of the page. This is the number 1 factor used to rank pages in most search engines
  • A description meta-tag (meta-tags are bits of code that are invisible to users but used by browsers and search engines).
  • A keyword meta-tag

More detail on setting up for Search can be found on the Information and Instructions for Web Site Creators page.

In order to search your site, it must be listed in the Stanford index. You can test a directory URL using the "Domains" field on the Advanced Search page. The Google appliance crawls all Stanford domains twice weekly and will index any site linked from any page in the index. You can request that a domain or directory be added using the HelpSU web form.

Stanford's Information and Instructions for Web Site Creators page has code you can copy and paste into the code for your page(s), plus explanations of what all the inputs mean and how to change variables to customize your search.

Or, you can use some code we've modified ourselves.

Sample search boxes

Stanford Medicine collection

The Stanford Google index includes a collection for the Medical Center, that includes all the known, indexed URIs for School of Medicine public Web sites and also the Stanford University Hospital & Clinics and Lucile Packard Children's Hospital sites. You can test for any specific URI using the Stanford Medicine Advanced Search page. This example also includes the School of Medicine proxystylesheet so that results are provided in the standard SoM Web format.

Search Stanford Medicine:

Here's code you can copy to create this search box:

Searching a specific site or directory

Search A Specific Site (in this example: med.stanford.edu/education):

Here's code you can copy to create this search box:

  1. Select and copy the following code:

  1. Paste the code into the HTML code for your page, where you want the Search box to appear.

  2. Change "med.stanford.edu/education" to the directory-level URL you want to be searched. Note that a final slash in the URL, i.e. "med.stanford.edu/pathto/yoursite/" will return results from that directory only, not subdirectories. To include all content within a given site or directory, leave off the final slash, i.e. "med.stanford.edu/pathto/yoursite" or "yoursite.stanford.edu"

  3. To search multiple sites or locations, add additional "site:[URL]" values with a space between, i.e.
    <input type='hidden' name='as_oq' value='site:med.stanford.edu/education site:med.stanford.edu/research site:med.stanford.edu/patient_care'>

  4. If your search form appears on a page mounted within a frame or iFrame, you may want to add the code 'target="_top"' to the form tag, i.e.
    <form action="http://ask.stanford.edu/search" method="get" target="_top">
    to keep the results page (and links forward from it) from being trapped inside the frame. You can also set 'target="_blank"' if you want your results to appear in a new browser window.

Last thought

Other form elements (like radio buttons, check boxes, pull-down menus) can be substituted for hidden fields to create user-selectable options.