You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Next »

Get search results from the CUL libraries collection

Default html interface:

http://web.search.cornell.edu/search?client=default_frontend&site=libraries&q=canoe

Here is a form that gives you results with the default interface:

<form action="http://web.search.cornell.edu/search" method="GET" name="gs">
<label for="search-form-query">SEARCH Cornell University Library Websites:<br /></label>
<input type="text" name="q" value="" size="50" maxlength="256" id="search-form-query" />
<input type="submit" name="btnG" value="go" id="search-form-submit" />
<input type="hidden" name="sort" value="" />
<input type="hidden" name="ie" value="UTF-8" />
<input type="hidden" name="gsa_client" value="default_frontend" />
<input type="hidden" name="oe" value="UTF-8" />
<input type="hidden" name="site" value="libraries" />  <!-- note: 'libraries' instead of 'default_collection' -->
</form>

If you want to embed the results in your web page you ask for them via xml:

http://web.search.cornell.edu/search?output=xml_no_dtd&client=default_frontend&site=libraries&q=canoe

Google XML Reference site

These documents show all the details about the xml structure returned from the Google Seach Appliance: 

http://code.google.com/enterprise/documentation/xml_reference.html

Modifying the search form

To use this library collection in a standard Cornell banner, set the form action to an intermediate file that will sort out parameters for web.search.cornell.edu :

<form action="qna-results.cfm" method="GET" name="gs">
	<div id="search-input">
		<label for="search-form-query">SEARCH:<br /></label>
		<input type="text" name="q" value="" size="50" maxlength="256" id="search-form-query" />
		<input type="submit" name="btnG" value="go" id="search-form-submit" />
		<input type="hidden" name="output" value="xml_no_dtd" />
		<input type="hidden" name="sort" value="" />
		<input type="hidden" name="ie" value="UTF-8" />
		<input type="hidden" name="gsa_client" value="default_frontend" />
		<input type="hidden" name="oe" value="UTF-8" />
	</div>
	<div id="search-filters">
		<input type="radio" name="sitesearch" value="this-site"  id="search-filters0" />
		<label for="search-filters1">This Site</label>
		<input type="radio" name="sitesearch" value="library.cornell.edu" checked="checked" id="search-filters1" />
		<label for="search-filters1">Library Pages</label>
		<input type="radio" name="sitesearch" value="cornell.edu"  id="search-filters2" />
		<label for="search-filters2">Cornell</label>
		<a href="http://web.search.cornell.edu/"              >more options</a>
	</div>
</form>

Here's a coldfusion search example, and here's a php search example.

Search Results - Coldfusion

Sanjeev Shukla presented Coldfusion code for handling the search results 4/12/06 at the CU Web Forum Meeting. He later released a second version with some bug fixes:

http://forum.web.cornell.edu/mtg_materials/gsa_package_v2.zip

Search Results - php

I've built a php object called cul_gsa_search() to handle the interaction with  http://web.search.cornell.edu and parse the xml results it returns. I also have an example wrapper script and css file to display the search results. I'll be happy to share this wrapper scrip with anyone who is interested, but it is written for a site that uses the Smarty template engine.

Style the results

I've attached a css stylesheet for Cornell Google search results as a starting point.  Certain results may be marked as 'Keymatch Results' and these get special styling.

  • No labels