#!/bin/sh if [[ ! -n $QUERY_STRING ]] then echo "Content-type: text/plain" echo "" echo "No record found, no search terms provided." echo "" echo "Example of proper usage:" echo "http://nut.lib.ucalgary.ca/uhtbin/ebook.cgi?general=love+trees&subject=biology&title=science&mesh=cadaver" echo "" echo "You can provide all 4 variables, or 3 or 2 or 1 but you must label the variable names:" echo "" echo " general, subject, title, mesh" echo "General searches general keyword index, subject searches subject indexes, title searches" echo "title index and mesh the mesh index." echo "" echo "Then follow the variable label with an equals sign and the term(s) you want to" echo "search in that variable. Multiple terms are separated with plus signs." echo "Ampersands separate the variable/search string pairs from following variables" fi if [[ -n $QUERY_STRING ]] then eval `echo "$QUERY_STRING" | tr "&+" "\012 " | sed -f hexconvert | sed -e 's/=/="/' -e 's/$/"/g'` #This is a "unique" string which will prevent browser #and ISP caching. unique_code=`date | sed 's/ /+/g'` #Define the site-specific fields (policy names, #fields, etc.) #Search indexes for first search area ... SUBJECT search_field="" kind_pol="SU" #keyword index bind_pol="SUBJECT" #browse index aths_pol="LCSUBJECT" #thesaurus index spec_proc="" label="subject" #Search indexes etc. for second search area ... GENERAL search_field2="" kind_pol2="GENERAL" bind_pol2="GENERAL" aths_pol2="GENERAL" spec_proc2="" label2="subject" #Search indexes etc. for third search area ... MESH search_field3="" kind_pol3="MESH" bind_pol3="MEDSUBJ" aths_pol3="MESH" spec_proc3="" label3="Medical Subject" #Search indexes etc. for fourth search area ... TITLE search_field4="" kind_pol4="TI" bind_pol4="TITLE" aths_pol4="TITLES" spec_proc4="Title Processing" label4="Title" #the fifth field is hard coded to target any record with an 856 containing http #SEARCH QUALIFIERS which relate to ALL search terms library="UCALGARY" #was ALL but we are a one library site system pubyear="" language="ANY" format="ANY" item_type="ANY" location="ANY" item_1cat="EBOOK" #matl-type...could change it to ANY item_2cat="ANY" match_on="KEYWORD" shadow="NO" sort_by="TI" echo "Location: /uhtbin/cgisirsi/${unique_code}/0/5?searchdata1=${subject}${search_field}&srchfield1=${kind_pol}^${bind_pol}^${aths_pol}^${spec_proc}^${label}&searchoper1=AND&thesaurus1=${aths_pol}&search_entries1=${kind_pol}&search_type1=${bind_pol}&special_proc1=${spec_proc}&searchdata2=${general}${search_field2}&srchfield2=${kind_pol2}^${bind_pol2}^${aths_pol2}^${spec_proc2}^${label2}&searchoper2=AND&thesaurus2=${aths_pol2}&search_entries2=${kind_pol2}&search_type2=${bind_pol2}&special_proc2=${spec_proc2}&searchdata3=${mesh}${search_field3}&srchfield3=${kind_pol3}^${bind_pol3}^${aths_pol3}^${spec_proc3}^${label3}&searchoper3=AND&thesaurus3=${aths_pol3}&search_entries3=${kind_pol3}&search_type3=${bind_pol3}&special_proc3=${spec_proc3}&searchdata4=${title}${search_field4}&srchfield4=${kind_pol4}^${bind_pol4}^${aths_pol4}^${spec_proc4}^${label4}&searchoper4=AND&thesaurus4=${aths_pol4}&search_entries4=${kind_pol4}&search_type4=${bind_pol4}^special_proc4=${spec_proc4}&searchdata5=http {856}&srchfield5=GENERAL^GENERAL^GENERAL^^words+or+phrase&searchoper5=AND&thesaurus5=GENERAL&search_entries5=GENERAL&search_type5=GENERAL&special_proc5=&library=${library}&pubyear=${pubyear}&language=${language}&format=${format}&item_type=${item_type}&location=${location}&item_1cat=${item_1cat}&item_2cat=${item_2cat}&match_on=${match_on}&shadow=${shadow}&sort_by=${sort_by}" echo fi