opensearch cleanup
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 27 Jan 2006 16:17:56 +0000 (16:17 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 27 Jan 2006 16:17:56 +0000 (16:17 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@2855 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/extras/opensearch.ttk
Open-ILS/src/extras/opensearch.xml
Open-ILS/src/extras/opensearchportal.html
Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/metabib.pm

index ba76495..3af2524 100644 (file)
@@ -4,6 +4,7 @@ USE ws = WebSession;
 j = ws.bootstrap_client("/pines/conf/bootstrap.conf");
 
 rank_threshold = 5000;
+base_url = 'http://fw1/';
 
 pagesize = 10;
 IF CGI.param('pagesize');
@@ -12,9 +13,6 @@ END;
 
 itempage = CGI.param('page');
 
-#type,string,location,depth
-count_meth = 'open-ils.search.biblio.class.count';
-
 #type,string,location,depth,limit,offset
 search_meth = 'open-ils.search.biblio.class';
 
@@ -24,7 +22,7 @@ type = CGI.param('mr_search_type');
 string = CGI.param('mr_search_query');
 location = CGI.param('mr_search_location');
 depth = CGI.param('mr_search_depth');
-max_rank = CGI.param('max_rank');
+max_rank = CGI.param('max_rank') || 0;
 limit = pagesize;
 offset = (itempage - 1) * pagesize;
 
@@ -32,30 +30,25 @@ IF offset < 0;
        offset = 0;
 END;
 
-count_req = session.request(count_meth, type, string, location, depth);
 id_req = session.request(search_meth, type, string, location, depth, limit, offset);
 
-j = count_req.wait_complete();
-count = count_req.recv().content();
-j = count_req.finish;
-
 j = id_req.wait_complete();
 list = id_req.recv().content();
 j = id_req.finish;
 
+count = list.count;
+
 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/"
-       xmlns:openIll="http://open-ils.org/xml/openIll/1.0">
+<rss version="2.0" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/">
     <channel>
       <title>Pines Catalogue Search: [% string | html %] </title>
-      <link>http://gapines.org/opensearch/?target=mr_result&amp;mr_search_type=[% type %]&amp;mr_search_query=[% string | uri | html %]&amp;page=[% itempage %]&amp;mr_search_depth=[% depth %]&amp;mr_search_location=[% location %]&amp;pagesize=[% pagesize %]&amp;max_rank=[% max_rank %]</link>
-      <description>Search results for "[% string | html %]" at gapines.org</description>
+      <link>[% base_url %]/opac/extras/opensearch/?target=mr_result&amp;mr_search_type=[% type %]&amp;mr_search_query=[% string | uri | html %]&amp;page=[% itempage %]&amp;mr_search_depth=[% depth %]&amp;mr_search_location=[% location %]&amp;pagesize=[% pagesize %]&amp;max_rank=[% max_rank %]</link>
+      <description>Search results for "[% string | html %]" at dev.gapines.org</description>
       <language>en-us</language>
       <copyright>&amp;copy;2004-2005, Georga Public Library Service.</copyright>
       <openSearch:totalResults>[% count %]</openSearch:totalResults>
@@ -66,33 +59,35 @@ END;
 
 mr_list = list.ids;
 
-FOREACH mr_id IN mr_list;
+FOREACH mr_id = mr_list;
        req = session.request('open-ils.search.biblio.metarecord.mods_slim.retrieve', mr_id.0);
        j = req.wait_complete();
 
        IF max_rank == 0;
                max_rank = mr_id.1;
+               '      <openSearch:relevanceScale>' _ max_rank _ "</openSearch:relevanceScale>\n";
        END;
-       '      <openIll:relevanceScale>' _ max_rank _ "</openIll:relevanceScale>\n";
 
        rank = mr_id.1 / max_rank;
        rank = rank * 100;
        rank = rank.split('\.').0;
 
+       #'<!-- Got a metarecord... ' _ mr_id.0 _ ' relevance: ' _ mr_id.1 _ ' rank: ' _ rank _ ' scale: ' _ max_rank _ '-->';
+
        mods = req.recv().content();
        j = req.finish;
 
 -%]
       <item>
         <title>[% mods.title() | html %]</title>
-        <link>http://gapines.org/opac/?sub_frame=1&amp;target=record_result&amp;page=0&amp;mrid=[% mr_id.0 %]&amp;hits_per_page=10</link>
-        <openIll:relevance>[% rank %]</openIll:relevance>
+        <link>[% base_url %]/opac/en-US/skin/default/xml/rresult.xml?m=[% mr_id.0 %]&amp;l=[% location %]</link>
+        <openSearch:relevance>[% rank %]</openSearch:relevance>
         <description>
 [%-
        IF mods.isbn();
 -%]
                &lt;div style="float: left;"&gt;
-                       &lt;a href="http://gapines.org/opac/?sub_frame=1&amp;target=record_result&amp;page=0&amp;mrid=[% mr_id.0 %]&amp;hits_per_page=10"&gt;
+                       &lt;a href="[% base_url %]/opac/en-US/skin/default/xml/rresult.xml?m=[% mr_id.0 %]&amp;l=[% location %]"&gt;
                                &lt;img
                                        style="padding: 3px; border: none;"
                                        width="45"
@@ -104,7 +99,7 @@ FOREACH mr_id IN mr_list;
        END;
        IF mods.author();
 -%]
-               &lt;b&gt;Author:&lt;/b&gt; &lt;a href="http://gapines.org/opac/?sub_frame=1&amp;target=mr_result&amp;mr_search_type=author&amp;mr_search_query=[% mods.author() | uri | html %]&amp;page=0&amp;mr_search_depth=[% depth %]&amp;mr_search_location=[% location %]"&gt;[% mods.author() | html %]&lt;/a&gt;&lt;br&gt;
+               &lt;b&gt;Author:&lt;/b&gt; &lt;a href="[% base_url %]/opac/en-US/skin/default/xml/mresult.xml?tp=author&amp;t=[% mods.author() | uri | html %]&amp;l=[% location %]"&gt;[% mods.author() | html %]&lt;/a&gt;&lt;br&gt;
 [%
        END;
        IF mods.subject();
@@ -120,7 +115,7 @@ FOREACH mr_id IN mr_list;
                        ', ';
                END;
                -%]
-&lt;a href="http://gapines.org/opac/?sub_frame=1&amp;target=mr_result&amp;mr_search_type=subject&amp;mr_search_query=[% sub | uri | html %]&amp;page=0&amp;mr_search_depth=[% depth %]&amp;mr_search_location=[% location %]"&gt;[% sub | html %]&lt;/a&gt;[%
+&lt;a href="[% base_url %]/opac/en-US/skin/default/xml/mresult.xml?tp=subject&amp;mr_search_query=[% sub | uri | html %]"&gt;[% sub | html %]&lt;/a&gt;[%
        END;
 %]
 &lt;br&gt;
@@ -159,7 +154,6 @@ FOREACH mr_id IN mr_list;
 
        END;
 %]
-               &lt;b&gt;Copies Available:&lt;/b&gt; [% mr_id.2 %] 
         </description>
       </item>
 [%-
index 417656c..5f50917 100644 (file)
@@ -1,18 +1,17 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <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&amp;mr_search_type=keyword&amp;mr_search_query={searchTerms}&amp;page={startPage}&amp;mr_search_depth=0&amp;mr_search_location=1&amp;pagesize={count}&amp;max_rank={relevanceScale}</Url>
+       xmlns="http://a9.com/-/spec/opensearchdescription/1.0/">
+  <Url>http://dev.gapines.org/opac/extras/opensearch?target=mr_result&amp;mr_search_type=keyword&amp;mr_search_query={searchTerms}&amp;page={startPage}&amp;mr_search_depth=0&amp;mr_search_location=1&amp;pagesize={count}&amp;max_rank={relevanceScale}</Url>
   <Format>http://a9.com/-/spec/opensearchrss/1.0/</Format>
-  <ShortName>Evergreen DEMO</ShortName>
-  <LongName>Pines Consortium DEMO OpenSearch Catalogue</LongName>
-  <Description>Search for books in Pines.</Description>
-  <Tags>book library research Evergreen Open-ILS GPLS</Tags>
-  <Image>http://gapines.org/images/small_logo.jpg</Image>
+  <ShortName>Evergreen/OpenILS DEMO</ShortName>
+  <LongName>PINES Consortium Evergreen/OpenILS DEMO OpenSearch Catalog</LongName>
+  <Description>Search for books in the PINES Catalog.</Description>
+  <Tags>book library research Evergreen Open-ILS OpenILS PINES GPLS</Tags>
+  <Image>http://dev.gapines.org/opac/images/small_logo.jpg</Image>
   <SampleSearch>harry potter</SampleSearch>
-  <Developer>GPLS</Developer>
+  <Developer>GPLS, Mike Rylander</Developer>
   <Contact>mrylander@gmail.com</Contact>
-  <Attribution>Product and search data &amp;copy; 2005, Georgia Public Library Service, All Rights Reserved</Attribution>
+  <Attribution>Product and search data &amp;copy; 2005-2006, Georgia Public Library Service, All Rights Reserved</Attribution>
   <SyndicationRight>open</SyndicationRight>
   <AdultContent>false</AdultContent>
 </OpenSearchDescription>
index fb61321..4fa33b4 100644 (file)
@@ -123,7 +123,7 @@ function create_requestor () {
        return req;
 }
 
-var proxy = 'http://gapines.org/opensearch/?fetch=';
+var proxy = 'http://dev.gapines.org/opac/extras/opensearch/?fetch=';
 
 var insearch=false;
 
@@ -610,7 +610,7 @@ var listening_elements = ['term','gobutton','res_count_per','res_type'];
                                                                                        }"
                                                                                name="source"
                                                                                type="checkbox"
-                                                                               value="http://gapines.org/opensearch.xml"
+                                                                               value="http://dev.gapines.org/opac/extras/opensearch.xml"
                                                                                checked>GPLS Pines
                                                                </label>
                                                        </td>
index c62235c..802b90f 100644 (file)
@@ -712,6 +712,7 @@ sub search_class_fts_count {
                SELECT  count(distinct  m.metarecord)
                  FROM  $search_table f,
                        $metabib_metarecord_source_map_table m,
+                       $metabib_metarecord_source_map_table mr,
                        $asset_call_number_table cn,
                        $asset_copy_table cp,
                        $cs_table cs,
@@ -719,7 +720,8 @@ sub search_class_fts_count {
                        $metabib_record_descriptor rd,
                        $descendants d
                  WHERE $fts_where
-                       AND m.source = f.source
+                       AND mr.source = f.source
+                       AND mr.metarecord = m.metarecord
                        AND cn.record = m.source
                        AND rd.record = m.source
                        AND cp.status = cs.id
@@ -735,9 +737,11 @@ sub search_class_fts_count {
                SELECT  count(distinct  m.metarecord)
                  FROM  $search_table f,
                        $metabib_metarecord_source_map_table m,
+                       $metabib_metarecord_source_map_table mr,
                        $metabib_record_descriptor rd
                  WHERE $fts_where
-                       AND m.source = f.source
+                       AND mr.source = f.source
+                       AND mr.metarecord = m.metarecord
                        AND rd.record = m.source
                        $t_filter
                        $f_filter
@@ -848,9 +852,9 @@ sub new_search_class_fts {
                                $metabib_metarecord_source_map_table mr,
                                $metabib_record_descriptor rd
                        WHERE   $fts_where
-                               AND m.source = f.source
+                               AND mr.source = f.source
                                AND mr.metarecord = m.metarecord
-                               AND rd.record = mr.source
+                               AND rd.record = m.source
                                $t_filter
                                $f_filter
                                AND EXISTS (