–– workshop home ––

Workshops

Scoped Search and the GSA

About the GSA

We have the Google Search Appliance. This lets us do a variety of things, including the ability to scope the results of a search, which cannot be done from the main Google search.

I have developed ASP scripts that facilitate this process. Once we get php on the main server, I'll make php scripts available as well.

Introduction

A scoped search means a search that is restricted to a specific server and/or directory. The default is to search all university pages. This is often more general than we might want. The Google Search Appliance gives us the ability to restrict the scope of the search. Doing this is quite easy: you need only drop in a section of code on any page of your choice.

The code is available by clicking on either link below:

When you click the link it will come up in a new instance (or tab) of your browser. Select it all and copy it to your own XHTML-compliant code and away you go!

Explanations

The code is all inside its own div. You can style this any way you like; there are no styles associated with it by default.

Important: The code is currently scoped to the Department of History, so you will want to change that to your own site. It can be a subdomain or any folder within a subdomain.

The script currently only deals with the ability to select a sub-domain or folder. If there are other options you would like to see—for example, to search on a type of document, or on a date range—contact the University Webmaster with your request. You can't change the behavior by changing the form itself.

Exercise: create your own scoped search page for your department

How to Customize the Results Page

When you implement scoped search, the results page is by default the same as the main university search pages. If your site has a substantially different look, you may want to customize the results so the page looks like the rest of your site.

This is very easy to do. Create a new page with your site's look and paste some code into it. Then make sure your search form points to that page.

Example

Let's say Department ABC wishes to implement a scoped search and this department has its own unique look. The url for the department is http://www.boisestate.edu/abc/

Site editors would copy the searchsample.txt code into wherever they want the search box to appear (probably best into a server-side include file). They would then create a page that looks like the rest of their site and copy the results code (below) onto that page. They would make sure that this page was called searchprocess.asp because that's how it's referenced int he GET statement.

Now go back and edit your search page; specifically, you must change the form action= statement to point to your copy of searchprocess.asp. You should made that call fully pathed, so that it will function from any folder within your site.

And done!

Sample

The results sample code is available by clicking on either link below (both launch a new window):

Exercise: add a scoped search to one of your departmental pages