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:
| No Format |
|---|
Modifying the search form
| Code Block |
|---|
<form action="search_browse.phphttp://web.search.cornell.edu/search" method="GET" name="gs"> <div id="search-input"> <label <label for="search-form-query">SEARCH:< Cornell University Library Websites:<br /></label> <input <input type="text" name="q" value="{$search_query}" size="2050" maxlength="256" id="search-form-query" /> <input<input type="submit" name="btnG" value="go" id="search-form-submit" /> <input<input type="hidden" name="sort" value="" /> <input type="hidden" name="outputie" value="xml_no_dtd"UTF-8" /> <input type="hidden" name="gsa_client" value="default_frontend" /> <input<input type="hidden" name="oe" value="UTF-8" /> <input type="hidden" name="sortsite" 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:
| Panel | ||
|---|---|---|
| ||
These documents show all the details about the xml structure returned from the Google Seach Appliance: http://code.google.com/apis/searchappliance/documentation/46/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 :
| No Format |
|---|
<form action="qna-results.cfm" method="GET" name="gs"> <div id="search-input"> <label for="search-form-query">SEARCH:<br /></label> <input> <input type="hiddentext" name="ieq" value="" size="50" maxlength="UTF-8"256" id="search-form-query" /> <input <input type="submit" name="btnG" value="go" id="search-form-submit" /> <input type="hidden" name="clientoutput" value="defaultxml_no_frontenddtd" /> <input <input type="hidden" name="sort" value="" /> <input type="hidden" name="oeie" value="UTF-8" /> <input <input type="hidden" name="sitegsa_client" value="default_collectionfrontend" /> < <input type="hidden" name="oe" value="UTF-8" /> </div> <div <div id="search-filters"> <input <input type="radio" name="sitesearch" value="{$thisSite}" {if empty($sitesearch) || ($sitesearch == "$thisSite")}this-site" id="search-filters0" /> <label for="search-filters1">This Site</label> <input type="radio" name="sitesearch" value="library.cornell.edu" checked="checked"{/if} id="search-filters1" /> <label <label for="search-filters1">This>Library site<Pages</label> <input <input type="radio" name="sitesearch" value="cornell.edu" {if ($sitesearch == "cornell.edu")}checked="checked"{/if} id="search-filters2" /> <label <label for="search-filters2">Cornell</label> <a <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 ~jgreidy: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 ~jgreidy:css file to display the search results. Here is the wrapper script and a test page. The code you will need to use will look like this:
| No Format |
|---|
<link rel="stylesheet" type="text/css" media="screen" href="search.css" />
</head>
<body>
<?php
require_once("cul_web_search.php");
cul_web_search_form();
?>
<h2>Search Results</h2>
<?php cul_web_search_results(); ?>
|
Style the results
I've attached a ~jgreidy:css stylesheet for Cornell Google search results as a starting point. Certain results may be marked as 'Keymatch Results' and these get special styling.
Here is a nice page from New York University describing how to style the xml Google search results using xsl.