Creating Search Forms

  1. How do I create a search form/box to put on my own page?
  2. What do all those input variables in the search form do? Do they have the same functionality as the public Google search?
  3. How can I search more than one site with a sitesearch query?

Q: How do I create a search form/box to put on my own page?
A: To create your own one-line form, you can use the code snippet provided below:
<form method="get" action="http://search.tamu.edu/search">
  <div>
    <input type="text" name="q" size="25" maxlength="255" value="" />
    <input type="submit" name="btnG" value="Google Search" />
    <input type="hidden" name="site" value="default_collection" />
    <input type="hidden" name="client" value="TAMU_frontend" />
    <input type="hidden" name="proxystylesheet" value="TAMU_frontend" />
    <input type="hidden" name="output" value="xml_no_dtd" />
  </div>
</form>
Q: What do all those input variables in the search form do? Do they have the same functionality as the public Google search?
A: The syntax for search queries with the Google Search Appliance is exactly the same as with the public Google search engine. Google's search documentation explains what each query parameter does. Any of these can be incorporated into the search form that you build to customize your returns.
Q: How can I search more than one site with a sitesearch query?
A: Only one sitesearch (or as_sitesearch) parameter per search request is supported. However, limiting a search to more than one specific site can be done using boolean operators:

Use site:
You can combine multiple site: query terms (that work the same way as sitesearch) as long as you separate them with OR, for example:

site:A OR site:B OR site:C

Use inurl:
Another solution is to use the as_q parameter with the inurl: query term. For example:

q=findme
as_q =(inurl:www.mycompany.com+OR+inurl:private.mycompany.com)

For complex multiple-site queries, consider setting up subcollections that span multiple sites.

← Back

Picture of the Google Search Appliance
Google Logo