The University of New Mexico

Adding A Search To Your Page

There are various ways you can incorporate a search form into your web site. This page will provide examples of the most common forms that can be implimented.

Search All of UNM

This form will search the enitre index of the UNM Search Engine. This form is commonly found on top level UNM pages.

<!-- Search UNM -->
<form name="unm" method="get" action="http://google.unm.edu/search">
<input type="text" name="q" size="25" maxlength="255" value=""/>
<input type="submit" name="submit" value="Search"/>
<input type="hidden" name="site" value="UNM"/>
<input type="hidden" name="client" value="UNM"/>
<input type="hidden" name="proxystylesheet" value="UNM"/>
<input type="hidden" name="output" value="xml_no_dtd"/>
</form>

Search a single web site

This form is used to create a search for a single departmental web site. The example form searches contents found in the its.unm.edu website. To use this form on your content simply change the url for the sitesearch to match the url of your web site. This search will also work with sites that have URLs such as http://www.unm.edu/~its.

<!-- SITE SEARCH -->
<form name="its-sitesearch" method="get" action="http://google.unm.edu/search">
<input type="text" name="q" size="25" maxlength="255" value=""/>
<input type="submit" name="submit" value="Search"/>
<input type="hidden" name="site" value="UNM"/>
<input type="hidden" name="client" value="UNM"/>
<input type="hidden" name="proxystylesheet" value="UNM"/>
<input type="hidden" name="output" value="xml_no_dtd"/>
<!-- optional field for site specific search -->
<input type="hidden" name="sitesearch" value="its.unm.edu" />
</form>

The following is an alternative search form for a single site. This form uses the as_sitesearch variable to convert the url of the designated site to a string in the search query.

<!-- SITE SEARCH -->
<form name="its-sitesearch" method="get" action="http://google.unm.edu/search">
<input type="text" name="q" size="25" maxlength="255" value=""/>
<input type="submit" name="submit" value="Search"/>
<input type="hidden" name="site" value="UNM"/>
<input type="hidden" name="client" value="UNM"/>
<input type="hidden" name="proxystylesheet" value="UNM"/>
<input type="hidden" name="output" value="xml_no_dtd"/>
<!-- optional field for site specific search -->
<input type="hidden" name="as_sitesearch" value="its.unm.edu" />
</form>

Multiple Site Search

The Multiple Site Search form allows you to simultaneously search multiple URLs in single search form.

<!-- Multiple Site Search -->
<form name="hsc-as_sitesearch" method="get" action="http://google.unm.edu/search">
<input type="text" name="q" size="25" maxlength="255" value=""/>
<input type="submit" name="submit" value="Search"/>
<input type="hidden" name="site" value="UNM"/>
<input type="hidden" name="client" value="UNM"/>
<input type="hidden" name="proxystylesheet" value="UNM"/>
<input type="hidden" name="output" value="xml_no_dtd"/>
<!-- optional field for site specific search -->
<input type='hidden' name='as_oq' value='site:hsc.unm.edu site:hospitals.unm.edu site:radiology.unm.edu site:obgyn.unm.edu'/>
</form>

Combination Search

The combination search form allows you to provide a form that will search the enitre index of the UNM Search Engine as well as an single web site. The flexibility is handled by the use of a selection box that lets the visitor click on which pages to search. <!-- COMBO SEARCH -->
<form name="its-sitesearch" method="get" action="http://google.unm.edu/search">
<input type="text" name="q" size="25" maxlength="255" value=""/>
<input type="submit" name="submit" value="Search"/>
<input type="hidden" name="site" value="UNM"/>
<input type="hidden" name="client" value="UNM"/>
<input type="hidden" name="proxystylesheet" value="UNM"/>
<input type="hidden" name="output" value="xml_no_dtd"/>
<!-- optional field for site specific search --><br />
<label for="search_unm">UNM</label><input id="search_unm" type="radio" name="sitesearch" checked="checked" value="" />
<label for="search_dept">ITS</label><input id="search_dept" type="radio" name="sitesearch" value="its.unm.edu" />
</form>

Retrieving XML search results

This search form will allow you to retrieve XML results for a search query. This method is not typically used as a search form but rather as a call with in a web applications. By pullilng the XML results into a web application you can render them using the look and feel of your web site.

<!-- xml results -->
<form name="unmxml" method="get" action="http://google.unm.edu/search">
<input type="text" name="q" size="25" maxlength="255" value=""/>
<input type="submit" name="submit" value="Search"/>
<input type="hidden" name="site" value="UNM"/>
<input type="hidden" name="client" value="UNM"/>
<input type="hidden" name="output" value="xml"/>
</form>

Search Parameters

This section lists the valid name-value pairs that can be used in a search request and describes how these parameters modify the search results.

All search requests must include the parameters site, client, and output. All parameter values must be URL-encoded, except where otherwise noted.

Parameter Description Default Value
access

Specifies whether to search public content, secure content, or both.

Possible values for the access parameter are:
  p - search only public content
  s - search only secure content
  a - search all content, both public and secure

This parameter is not supported on Google Mini.

p
as_dt Modifies the as_sitesearch parameter as follows:
Value Modification
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
as_epq Adds the specified phrase to the search query in parameter q. This parameter has the same effect as using the phrase special query term. Empty string
as_eq Excludes the specified terms from the search results. This parameter has the same effect as using the exclusion (-) special query term. Empty string
as_lq Specifies a URL, and causes search results to show pages that link to the that URL. This parameter has the same effect as the link special query term. No other query terms can be used when using this parameter.
Empty string
as_occt Specifies where the search engine is to look for the query terms on the page: anywhere on the page, in the title, or in the URL.

Value Meaning
any anywhere on the page
title in the title of the page
URL in the URL for the page

any
as_oq Combines the specified terms to the search query in parameter q, with an OR operation. This parameter has the same effect as the OR special query term. Empty string
as_q Adds the specified query terms to the query terms in parameter q.
Empty string
as_sitesearch Limits search results to documents in the specified domain, host or web directory, or excludes results from the specified location, depending on the value of as_dt. This parameter has the same effect as the site or -site special query terms. It has no effect if the q parameter is empty.

When the Google Search Appliance receives a search request that includes the as_sitesearch parameter, it converts the value of the parameter into an argument to the site special query term and appends it to the value of q in the search results. For example, suppose that a search contains these parameters:
    q=mycompany&as_sitesearch=www.mycompany.com
The raw XML of the search results contains the following:
    <q>mycompany site:www.mycompany.com</q>
The default XSLT stylesheet displays the value of the q tag in the search box on the results page. Consequently, using an as_sitesearch parameter will appear to change the user's search query by modifying the contents of the search box.

The specified value for as_sitesearch must contain fewer than 125 characters.
Empty string
client A string that indicates a valid front end. REQUIRED
entqr Reserved for internal use by the search appliance, this parameter sets the query expansion policy according to the following valid values:

0 -- None
1 -- Standard
2 -- Local
3 -- Full

This parameter is for internal use only. Even if you explicitly set entqr in a search request, the search appliance uses the query expansion policy defined in the front end. You can set the query expansion policy using controls in the front end's Filters tab.
0
entsp Reserved for internal use by the search appliance, this parameter controls the use of advanced relevance scoring according to the following valid values:

0 -- Standard
a -- Advanced scoring

Advanced scoring uses the parameters set under Result Biasing. If the value is omitted, the value specified for the front end is used.


This parameter is for internal use only. Even if you explicitly set entsp in a search request, the search appliance uses the scoring policy defined in the front end. You can enable Results Biasing using controls in the front end's Filters tab.
0
filter Activates or deactivates automatic results filtering. By default, filtering is applied to Google search results to improve results quality. See Automatic Filtering for more details. 1
getfields Indicates that the names and values of the specified meta tags should be returned with each search result, when available. See Meta Tags section for more details.
Meta tag names or values must be double URL-encoded.
Empty string
ie Sets the character encoding that is used to interpret the query string. See Internationalization section for details. latin1
ip Contains the IP address of the user who submitted the search query. You do not supply this parameter with the search request. The ip parameter is returned in the XML search results. Value is not set in the search request; the value is automatically returned in the search results.
lr Restricts searches to pages in the specified language. If there are no results in the selected language, the appliance will show results in all languages. The appliance may use the language parameter to segment search queries in some Asian languages that do not normally have spaces between words. As a result, you might see different results to your search depending on the value of the lr parameter. See Language Filters section for more details. Empty string
num Maximum number of results to include in the search results. The maximum value of this parameter is 100. Along with start these parameters determine the index range of the results that are returned.

The actual number of results may be smaller than the requested value. The appliance returns no more than 1,000 results total for a single query.
10
numgm Number of KeyMatch results to return with the results. A value between 0 to 5 can be specified for this option. 3
oe Sets the character encoding that is used to encode the results. See Internationalization section for details. UTF8
output Selects the format of the search results.
Value Output Format
xml_no_dtd XML results or custom HTML
(See proxystylesheet parameter for details.)
xml XML results with Google DTD reference. When you use this value, omit proxystylesheet or set it to an empty string.
REQUIRED
partialfields Restricts the search results to documents with meta tags whose values contain the specified words or phrases.
(See Meta Tags section for more details.)
Meta tag names or values must be double URL-encoded.
Empty string
proxycustom Specifies custom XML tags to be included in the XML results. The default XSLT stylesheet uses these values for this parameter: <HOME/>, <ADVANCED/>.< The proxycustom parameter can be used in custom XSLT applications. See the Custom HTML output section for more details.

T his parameter is disabled if the search request does not contain the proxystylesheet tag. If custom XML is specified, search results are not returned with the search request.
Custom XML must be URL-encoded.
Empty string
proxyreload Instructs the Google Search Appliance when to refresh the XSL stylesheet cache. A value of 1 indicates that the Google Search Appliance should update the XSL stylesheet cache to refresh the stylesheet currently being requested. This parameter is optional. By default, the XSL stylesheet cache is updated approximately every 15 minutes. (See the Custom HTML section for more details.) 0
proxystylesheet If the value of the output parameter is xml_no_dtd, the output format is modified by the proxystylesheet value as follows:
Proxystylesheet Value Output Format
Omitted Results are in XML format.
Empty Results are in XML format, with a content-type of text/html (rather than text/xml), because the XML results are not transformed.
Front End Name Results are in Custom HTML format. The XSL stylesheet associated with the specified Front End is used to transform the output.

See the Custom HTML section for more details.
N/A
q Search query as entered by the user.
See Query Terms section for additional query features.
Empty string
requiredfields Restricts the search results to documents that contain the exact meta tag names or name-value pairs. See Meta Tags section for more details.
Custom XML must be URL-encoded.
Empty string
site

Limits search results to the contents of the specified collection. You can search over multiple collections by including multiple collection names separated by the pipe character ( | ) .

Query terms info, link and cache ignore collection restrictions that are specified by the site query parameter.

REQUIRED
sitesearch Limits search results to documents in the specified domain, host, or web directory. Has no effect if the q parameter is empty. This parameter has the same effect as the site special query term.

Unlike the as_sitesearch parameter, the sitesearch parameter is not affected by the as_dt parameter. The sitesearch and as_sitesearch parameters are handled differently in the XML results. The sitesearch parameter's value is not appended to the search query in the results. The original query term is not modified when you use the sitesearch parameter. The specified value for this parameter must contain fewer than 125 characters.
Empty string
sort Specifies a sorting method. Results can be sorted by date. (See Sorting section for sort parameter format and details.)
Empty string
start Specifies the index number of the first entry in the result set that is to be returned. Use this parameter, along with num, to implement page navigation for search results. The index number of the results is 0-based.

Examples:
start=0, num=10, returns the first 10 results (these are returned by default if no start or num are specified.)
start=10, num=10, returns the next 10 results.

The maximum number of results available for a query is 1,000, i.e., the value of the start parameter added to the value of the num parameter cannot exceed 1,000.
0
ud This parameter specifies whether to include the IDN-encoded URL for the search result. IDN (International Domain Name) encoding allows domains to be displayed using local languages. These are the valid values:

0 -- Do not include IDN-encoded URLs in search results.
1 -- Include IDN-encoded URLs in search results.
0