Setup a search on your site to search only information that you choose

Once your information is indexed and ready to search, you can add a search box to any existing Web page. The way the search works is that a form is submitted with specific variables that define how to complete the search. To add a search to any page, copy the bolded text in the example below and paste it into the body of an existing page.

 

<!-- start Search University of Wyoming Google Index-->
<form method="GET" action="http://searchuw.uwyo.edu">
 <input type="text" name="q" size="32" maxlength="250" value="">

 <input type="submit" name="btnG" value="UW Search"/>
 <input type="hidden" name="site" value="UWYO"/>
 <input type="hidden" name="client" value="UWYO"/>
 <input type="hidden" name="proxystylesheet" value="UWYO"/>
 <input type="hidden" name="output" value="xml_no_dtd"/>

</form>
<!-- end Search University of Wyoming Google Index-->

 

 

Restrict searches to a specific website or domain

(includes code changes resulting from the Feb. 09 upgrade)

To restrict the search box to only returns results from an entire Web domain, a single Web site, or a subset of a Web site, add the "as_sitesearch" parameter to the search form code above:

    <input type="hidden" name="as_sitesearch" value="your_url_here"> 

You can also restrict the search to a specific directory under a domain:

    <input type="hidden" name="as_sitesearch" value="your_url_here/directory">


 

Note: If a trailing slash '/' is used at the end of the URL value, then the search will be restricted to only that specific folder. In the example above, which does not use a trailing slash, results will be returned for the directory folder and all subfolders under it.

 

 

Specify a search across multiple UW websites

(includes code changes resulting from the Feb. 09 upgrade)

To specify a search across multiple Web sites, use the "as_q" parameter instead of "as_sitesearch", and use "site:" and one or more "OR" operators in the value:

    <input type="hidden" name="as_q" value="site:your_first_url OR site:your_second_url"> 

It might be helpful to show that your search is a site-restricted search in the search button. To do this, modify the code for the btnG parameter:

    <input type="submit" name="btnG" value="Search your_sitename_here">


Multi-Site Search Examples
<!-- start Search University of Wyoming Google Index-->
<form method="get" action="http://searchuw.uwyo.edu/search">
  <input type="text" name="q" size="32" maxlength="250" value=""/>
  <input type="hidden" name="as_q" value="site:uwadmnweb.uwyo.edu/ag 
OR site:uwadmnweb.uwyo.edu/agcollege"/>
  <input type="submit" name="btnG" value="Search UW Ag"/>
  <input type="hidden" name="site" value="UWYO"/>
  <input type="hidden" name="client" value="UWYO"/>
  <input type="hidden" name="proxystylesheet" value="UWYO"/>
  <input type="hidden" name="output" value="xml_no_dtd"/>
</form>

<!-- end Search University of Wyoming Google Index-->

NOTE: The line <input type="hidden" name="as_q" value="site:uwadmnweb.uwyo.edu/ag OR site:uwadmnweb.uwyo.edu/agcollege"/> will be specific to your situation and is optional. This line is what limits or narrows the search to one or more specific sites within the UW Web. If you want your search to return results from all sites indexed by the UW search engine, omit this line.  In this example, this line defines the search to only return matches that are within the www.uwyo.ed/ag or www.uwyo.edu/agcollege Web sites specifically.

Was this helpful?
0 reviews

Details

Article ID: 8288
Created
Mon 8/10/15 7:59 AM
Modified
Fri 8/14/15 10:50 AM