How do I set up a custom search box for an IU web site?
You can add a search box to your Indiana University web site to help
visitors find information on your site. You can restrict the search to
a specified directory, or search the entire IU web site.
When a visitor enters a search term and clicks Search, the
page will leave your site and display the search results in a
formatted page. To add a search box to your page:
- Insert the following HTML into your web page where you
want the search box to appear:
<form method='get'
action='http://search2.iu.edu/search'> <input
type='text' name='q' size='32' maxlength='255'
value=''/> <input type='submit' name='btnG'
value='Search'/> <input type='hidden' name='site'
value='indiana'/> <input type='hidden' name='client'
value='indiana'/> <input type='hidden'
name='proxystylesheet' value='indiana'/>
<input type='hidden' name='output' value='xml_no_dtd'/>
<input type='hidden' name='as_dt' value='i'/>
<input type='hidden' name='as_sitesearch'
value='<yoururl>'/>
</form>
Note: If you have been using the Ultraseek (Verity) search feature on your page, be sure to replace the complete Ultraseek HTML section of your page with the complete Google HTML section above.
- Customize the following parameters:
-
name='q' size='32' : Sets the width (in
number of characters) of the search box. You can change the size to
suit your site's layout, but don't change the maxlength value.
-
name='btnG' value='Search' : The text that
appears on the search button (e.g.,
Search School of Medicine Site).
-
name='q' size='32' : Sets the width (in
number of characters) of the search box. You can change the size to
suit your site's layout, but don't change the maxlength value.
- Customize the stylesheet parameter. There are two stylesheets
available for the display of search results:
-
name='proxystylesheet'
value='indiana' : This is the default
stylesheet, as specified in the HTML above. This stylesheet includes a
menu of defined subcollections.
- name='proxystylesheet' value='http://search.iu.edu/stylesheet.xslt' : This stylesheet, from the main IU search site, does not include the subcollections menu, but does include a people search option and navigation to the IU directories and A-Z Index.
-
name='proxystylesheet'
value='indiana' : This is the default
stylesheet, as specified in the HTML above. This stylesheet includes a
menu of defined subcollections.
- If you want to restrict your search feature to a specific
directory (and its subdirectories), include the following two
parameters:
as_dtandas_sitesearch. If you want the search feature on your site to search the entire IU collection, remove these two parameters from your HTML. If you include these parameters, customize them as follows:
-
name='as_dt' value='i' : Determines whether
your search should include or exclude the directory specified in
'as_sitesearch'. Values can be:
-
'i' (include only results in the web directory
specified by
as_sitesearch) -
'e' (exclude all results in the web directory
specified by
as_sitesearch)
-
'i' (include only results in the web directory
specified by
-
name='as_sitesearch'
value='<yoururl>' : Pages in the specified
directory will be included in or excluded from your search (according
to the value of
'as_dt'). For example: name='as_sitesearch' value='cs.indiana.edu'Note the following:
- You must specify the complete canonical name of the host server
followed by the path of the directory (e.g.,
www.iu.edu/services, notwww/services).
- If the
/(forward slash) character is at the end of the web directory path specified, then only files within that directory will be searched and files in subdirectories will not be considered (e.g.,www.iu.edu/serviceswill include subdirectories, whilewww.iu.edu/services/will exclude subdirectories).
- The parameter
as_sitesearchallows you to specify one directory (and all its subdirectories) as the domain to be searched; you cannot specify multiple disparate directories using this option.
- If you want the search feature on your site to search the entire IU web site, delete this parameter.
- You must specify the complete canonical name of the host server
followed by the path of the directory (e.g.,
-
name='as_dt' value='i' : Determines whether
your search should include or exclude the directory specified in
For more detailed information on search parameters, see Search Parameters on Google's Search Protocol Reference page.
Last modified on September 28, 2011.







