The Wayback Machine - https://web.archive.org/all/20060320224938/http://www.stanford.edu/services/websearch/Google/asq_documentation.html
STANFORD UNIVERSITY

INFORMATION TECHNOLOGY SERVICES

Using the as_q and as_oq parameters

Overview

The as_q and as_oq parameters allow you to add search terms to the query your web site passes to the Google Search Appliance. Unlike as_sitesearch, these parameters allow you to combine multiple terms or URLs with boolean AND or OR.

as_sitesearch with as_dt

use: restrict search to a specific URL

<input type='hidden' name='as_dt' value='i'/>
<input type='hidden' name='as_sitesearch' value='www.gsb.stanford.edu'/>

result: finds only pages in the www.gsb.stanford.edu site that include the user's search term(s)

use: exclude pages from a specific URL

<input type='hidden' name='as_dt' value='e'/>
<input type='hidden' name='as_sitesearch' value='gostanford.com'/>

result: finds pages in the Stanford collection, but not on the gostanford.com site, that include the user's search term(s)

as_q

use: add one or more search terms to the query, combined with boolean 'AND'

<input type='hidden' name='as_q' value='gsb sloan'/>

result: finds only pages in the Stanford collection that contain the user's search term(s) AND the terms 'gsb' AND 'sloan'.

as_oq

use: add one or more search terms to the query, combined with boolean 'OR'

<input type='hidden' name='as_oq' value='gsb sloan'/>

result: finds only pages in the Stanford collection that include the user's search term(s) OR the terms 'gsb' AND 'sloan'

Before you start

The as_q and as_oq parameters have some effects on the results page that you should be aware of before using them on your site.

Displaying Results

When the results page for a search is displayed, the query term is shown in a blue bar at the top of the results, like this:

Searched for admissions.Results 1-10 of about 5930. Search took 0.18 seconds.

("admissions" is the search term entered by the user)

When you add search terms to a query, those terms are also displayed in the blue bar. For example, if you use as_sitesearch to restrict the search to a specific site, it would display like this:

Searched for admissions site:scpd.stanford.edu.Results 1-10 of about 29. Search took 0.09 seconds.

If you use as_q to add key words to a query:

Searched for admissions gsb AND sloan.Results 1-10 of about 122. Search took 0.08 seconds.

If you use as_oq to add multiple URLs to a query:

Searched for hennessy site:www.stanfordalumni.org/news+site:www.stanford.edu/news+(etc.)

The blue bar stretches in width—depending on how many URLs you've specified—to the point where it may exceed the browser window size and require horizontal scrolling.


Next Search
When you use the as_sitesearch, as_q or as_oq parameters to pass query terms to the Google Search Appliance, the results page displays the complete query in the blue bar, but only the user's search term in the search box. If the user changes or adds to their search term, the next search will be done against the entire Stanford collection—your parameters will no longer be included.


Subcollections
As an alternative to using these search parameters, schools and other large organizations may be eligible to define a subcollection (a list of URL patterns that can be referred to by a single name to restrict queries) in the Google Search Appliance. Use of a subcollection to restrict searches avoids the results display and next search effects of the as_q and as_oq parameters. Defining and using a subcollection requires startup effort from both the Stanford search administrator and the web site developer. If you think you are eligible and want to define a subcollection, enter a HelpSU request.

Using the as_q and as_oq parameters

(See Information and Instructions for Web Creators for details about the <form> tag.)

as_q (AND)

Add the following line to the search <form> tag in your web page:

<input type='hidden' name='as_q' value='<yourterms>'/>

In place of <yourterms>, list the terms you want to add to your users' queries, separated by a space.
e.g.:

   'gsb sloan'

as_oq (OR)

Add the following line to the search <form> tag in your web page:

<input type='hidden' name='as_oq' value='<yourterms>'/>

In place of <yourterms>, list the terms you want to add to your users' queries, separated by a space.
e.g.:

   'gsb sloan'

 

If you have questions about using these parameters with the Google Search Appliance, enter a HelpSU request.

Last modified Friday, 20-Jan-2006 04:03:59 PM

Stanford University Home Page