use Apache::RequestRec ();
use Apache::RequestIO ();
use Apache::RequestUtil;
+use LWP::UserAgent;
use CGI ();
use Template qw(:template);
my $apache = shift;
print "Content-type: text/xml; charset=utf-8\n\n";
- my $template = Template->new( {
- OUTPUT => $apache,
- ABSOLUTE => 1,
- RELATIVE => 1,
- PLUGIN_BASE => 'OpenILS::Template::Plugin',
- INCLUDE_PATH => ['/pines/cvs/ILS/Open-ILS/src/extras'],
- PRE_CHOMP => 1,
- POST_CHOMP => 1,
- }
- );
+ my $cgi = new CGI;
+
+ if (my $fetch = $cgi->param('fetch')) {
- try {
+ print LWP::UserAgent->new->get($fetch)->content;
- if( ! $template->process( 'opensearch.ttk' ) ) {
- warn "Error processing template opensearch.ttk\n";
- warn "Error Occured: " . $template->error();
- my $err = $template->error();
- $err =~ s/\n/\<br\/\>/g;
- print "<br><b>Unable to process template:<br/><br/> " . $err . "!!!</b>";
- }
-
- } catch Error with {
- my $e = shift;
- warn "Error processing template opensearch.ttk: $e - $@ \n";
- print "<center><br/><br/><b>Error<br/><br/> $e <br/><br/> $@ </b><br/></center>";
- return;
- };
+ } else {
+ my $template = Template->new( {
+ OUTPUT => $apache,
+ ABSOLUTE => 1,
+ RELATIVE => 1,
+ PLUGIN_BASE => 'OpenILS::Template::Plugin',
+ INCLUDE_PATH => ['/pines/cvs/ILS/Open-ILS/src/extras'],
+ PRE_CHOMP => 1,
+ POST_CHOMP => 1,
+ }
+ );
+ try {
+
+ if( ! $template->process( 'opensearch.ttk' ) ) {
+ warn "Error processing template opensearch.ttk\n";
+ warn "Error Occured: " . $template->error();
+ my $err = $template->error();
+ $err =~ s/\n/\<br\/\>/g;
+ print "<br><b>Unable to process template:<br/><br/> " . $err . "!!!</b>";
+ }
+ } catch Error with {
+ my $e = shift;
+ warn "Error processing template opensearch.ttk: $e - $@ \n";
+ print "<center><br/><br/><b>Error<br/><br/> $e <br/><br/> $@ </b><br/></center>";
+ return;
+ };
+ }
return Apache::OK;
}
string = CGI.param('mr_search_query');
location = CGI.param('mr_search_location');
depth = CGI.param('mr_search_depth');
+max_rank = CGI.param('max_rank');
limit = pagesize;
-offset = ((itempage - 1) * pagesize) - 1;
+offset = (itempage - 1) * pagesize;
IF offset < 0;
offset = 0;
list = id_req.recv().content();
j = id_req.finish;
-max_rank = 0;
+IF max_rank == '{relevanceScale}';
+ max_rank = 0;
+END;
-%]
<?xml version="1.0"?>
-<rss version="2.0" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/">
+<rss version="2.0"
+ xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/"
+ xmlns:openIll="http://open-ils.org/xml/openIll/1.0">
<channel>
<title>Pines Catalogue Search: [% string | html %] </title>
- <link>http://http://gapines.org/opensearch/?target=mr_result&mr_search_type=[% type %]&mr_search_query=[% string | uri | html %]&page=[% itempage %]&mr_search_depth=[% depth %]&mr_search_location=[% location %]</link>
+ <link>http://http://gapines.org/opensearch/?target=mr_result&mr_search_type=[% type %]&mr_search_query=[% string | uri | html %]&page=[% itempage %]&mr_search_depth=[% depth %]&mr_search_location=[% location %]&pagesize=[% pagesize %]&max_rank=[% max_rank %]</link>
<description>Search results for "[% string | html %]" at gapines.org</description>
<language>en-us</language>
<copyright>&copy;2004-2005, Georga Public Library Service.</copyright>
<openSearch:totalResults>[% count %]</openSearch:totalResults>
<openSearch:startIndex>[% offset + 1 %]</openSearch:startIndex>
<openSearch:itemsPerPage>[% pagesize %]</openSearch:itemsPerPage>
+
[%-
mr_list = list.ids;
IF max_rank == 0;
max_rank = mr_id.1;
+ ' <openIll:relevanceScale>' _ max_rank _ "</openIll:relevanceScale>\n";
END;
rank = mr_id.1 / max_rank;
<item>
<title>[% mods.title() | html %]</title>
<link>http://gapines.org/opac/?sub_frame=1&target=record_result&page=0&mrid=[% mr_id.0 %]&hits_per_page=10</link>
- <rank>[% rank %]</rank>
+ <openIll:relevance>[% rank %]</openIll:relevance>
<description>
[%-
IF mods.author();
<?xml version="1.0" encoding="UTF-8"?>
-<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearchdescription/1.0/">
- <Url>http://gapines.org/opensearch/?target=mr_result&mr_search_type=keyword&mr_search_query={searchTerms}&page={startPage}&mr_search_depth=0&mr_search_location=1</Url>
+<OpenSearchDescription
+ xmlns="http://a9.com/-/spec/opensearchdescription/1.0/"
+ xmlns:openIll="http://open-ils.org/xml/openIll/1.0">
+ <Url>http://gapines.org/opensearch/?target=mr_result&mr_search_type=keyword&mr_search_query={searchTerms}&page={startPage}&mr_search_depth=0&mr_search_location=1&pagesize={count}&max_rank={relevanceScale}</Url>
<Format>http://a9.com/-/spec/opensearchrss/1.0/</Format>
<ShortName>Pines</ShortName>
<LongName>Pines Consortium Catalogue</LongName>