testing out new storage method to retrieve the count with the ids instead of
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 12 Aug 2005 16:44:24 +0000 (16:44 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 12 Aug 2005 16:44:24 +0000 (16:44 +0000)
retrieving it separately

git-svn-id: svn://svn.open-ils.org/ILS/trunk@1647 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/javascript/lib/js/opac/config.js
Open-ILS/src/javascript/lib/js/opac/mresult.js
Open-ILS/src/javascript/lib/js/opac/rresult.js
Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm

index 29a2441..efe3538 100644 (file)
@@ -205,6 +205,7 @@ config.ids.altcanvas.org_tree        = config.ids.common.org_container;
 
 var FETCH_MRCOUNT                              = "open-ils.search:open-ils.search.biblio.class.count:1";
 var FETCH_MRIDS                                = "open-ils.search:open-ils.search.biblio.class:1";
+var FETCH_MRIDS_FULL                   = "open-ils.search:open-ils.search.biblio.class.full:1";
 var FETCH_MRMODS                               = "open-ils.search:open-ils.search.biblio.metarecord.mods_slim.retrieve";
 var FETCH_MR_COPY_COUNTS       = "open-ils.search:open-ils.search.biblio.metarecord.copy_count:1";
 var FETCH_RIDS                                 = "open-ils.search:open-ils.search.biblio.metarecord_to_records:1";
index 3b3157f..b61034a 100644 (file)
@@ -15,17 +15,18 @@ function mresultDoSearch() {
                hideMe(table.appendChild(G.ui.result.row_template.cloneNode(true)));
 
        if(getOffset() == 0 || getHitCount() == null ) {
-               mresultGetCount(); /* get the hit count */
-               mresultCollectIds(); /* do the actual search */
+       //      mresultGetCount(); 
+               mresultCollectIds(FETCH_MRIDS_FULL); 
        } else { 
                resultSetInfo();
-               mresultCollectIds();
+               mresultCollectIds(FETCH_MRIDS);
        }
 }
 
 function mresultGetCount() {
+       var form = (getForm() == "all") ? null : getForm();
        var req = new Request(FETCH_MRCOUNT, 
-                       getStype(), getTerm(), getLocation(), getDepth(), getForm() );
+                       getStype(), getTerm(), getLocation(), getDepth(), form );
        req.callback(mresultHandleCount);
        req.send();
 }
@@ -37,7 +38,7 @@ function mresultHandleCount(r) {
 
 
 /* performs the actual search */
-function mresultCollectIds() {
+function mresultCollectIds(method) {
 
 
        if(getOffset() == 0) {
@@ -55,15 +56,22 @@ function mresultCollectIds() {
 
        } else {
 
-               var req = new Request(FETCH_MRIDS, getStype(), getTerm(), 
-                       getLocation(), getDepth(), getDisplayCount() * 5, getOffset(), getForm() );
+               var req = new Request(method, getStype(), getTerm(), 
+                       getLocation(), getDepth(), getDisplayCount() * 20, getOffset(), getForm() );
                req.callback(mresultHandleMRIds);
                req.send();
        }
 }
 
 function mresultHandleMRIds(r) {
-       mresultSetRecords(r.getResultObject().ids);
+       var res = r.getResultObject();
+
+       if(res.count != null) {
+               HITCOUNT = res.count;
+               resultSetInfo();
+       } 
+
+       mresultSetRecords(res.ids);
        mresultCollectRecords(); 
 }
 
index 3547a0a..d24755b 100644 (file)
@@ -13,7 +13,8 @@ function rresultDoSearch() {
 }
 
 function rresultCollectIds() {
-       var req = new Request(FETCH_RIDS, getMrid(), getForm() );
+       var form = (getForm() == "all") ? null : getForm();
+       var req = new Request(FETCH_RIDS, getMrid(), form );
        req.callback( rresultHandleRIds );
        req.send();
 }
index e0b4920..21873c4 100644 (file)
@@ -553,14 +553,6 @@ sub biblio_search_class_count {
                "depth: $org_type\n"            .
                "format: $format\n";
 
-#      my $bool = ($class eq "subject" || $class eq "keyword");
-#      $string = OpenILS::Application::Search->filter_search($string, $bool);
-
-#      if(!$string) { 
-#              return OpenILS::EX->new("SEARCH_TOO_LARGE")->ex;
-#      }
-
-               
        if( !defined($org_id) or !$class or !$string ) {
                warn "not enbough args to metarecord search\n";
                throw OpenSRF::EX::InvalidArg 
@@ -609,19 +601,29 @@ __PACKAGE__->register_method(
 
 __PACKAGE__->register_method(
        method  => "biblio_search_class",
-       api_name        => "open-ils.search.biblio.class.unordered",
+       api_name        => "open-ils.search.biblio.class.full",
 );
 
 __PACKAGE__->register_method(
        method  => "biblio_search_class",
-       api_name        => "open-ils.search.biblio.class.staff",
+       api_name        => "open-ils.search.biblio.class.full.staff",
 );
 
+#__PACKAGE__->register_method(
+#      method  => "biblio_search_class",
+#      api_name        => "open-ils.search.biblio.class.unordered",
+#);
+
 __PACKAGE__->register_method(
        method  => "biblio_search_class",
-       api_name        => "open-ils.search.biblio.class.unordered.staff",
+       api_name        => "open-ils.search.biblio.class.staff",
 );
 
+#__PACKAGE__->register_method(
+#      method  => "biblio_search_class",
+#      api_name        => "open-ils.search.biblio.class.unordered.staff",
+#);
+
 sub biblio_search_class {
 
        my( $self, $client, $class, $string, 
@@ -629,6 +631,10 @@ sub biblio_search_class {
 
        warn "org: $org_id : depth: $org_type : limit: $limit :  offset: $offset\n";
 
+
+# new method:  metabib.<class>.new_search_fts.metarecord.<staff>
+
+
        $offset         = 0     unless (defined($offset) and $offset > 0);
        $limit          = 100 unless (defined($limit) and $limit > 0);
        $org_id         = "1" unless (defined($org_id)); # xxx
@@ -661,19 +667,22 @@ sub biblio_search_class {
                throw OpenSRF::EX::InvalidArg ("Not a valid search class: $class")
        }
 
-       #my $method = "open-ils.storage.metabib.$class.search_fts.metarecord.atomic";
        my $method = "open-ils.storage.cachable.metabib.$class.search_fts.metarecord.atomic";
 
-       if($self->api_name =~ /order/) {
-               $method = "open-ils.storage.cachable.metabib.$class.search_fts.metarecord.unordered.atomic",
-               #$method = "open-ils.storage.metabib.$class.search_fts.metarecord.unordered.atomic";
-       }
+#      if($self->api_name =~ /order/) {
+#              $method = "open-ils.storage.cachable.metabib.$class.search_fts.metarecord.unordered.atomic",
+#      }
 
        if($self->api_name =~ /staff/) { 
                $method =~ s/atomic/staff\.atomic/og;
                $method =~ s/\.cachable//o;
        }
 
+       if($self->api_name =~ /full/) { 
+               $method =~ s/search_fts/new_search_fts/o;
+               $method =~ s/\.cachable//o; #XXX testing..
+       }
+
        warn "Performing search method $method\n";
        warn "MR search method is $method\n";
 
@@ -702,6 +711,7 @@ sub biblio_search_class {
        warn "Received " . scalar(@$records) . " id's from class search\n";
 
        # if we just get one, it won't be wrapped in an array
+
        if(!ref($records->[0])) {
                $records = [$records]; } 
        for my $i (@$records) { 
@@ -716,11 +726,20 @@ sub biblio_search_class {
        $session->finish();
        $session->disconnect();
 
-       return { ids => \@ids };
+       my $count = undef;
+       if($self->api_name =~ /full/) { 
+               if(ref($records) && $records->[0]) {
+                       $count = $records->[0]->[3];
+               }
+       }
+
+       return { ids => \@ids, count => $count };
 
 }
 
 
+
+
 __PACKAGE__->register_method(
        method  => "biblio_mrid_to_modsbatch_batch",
        api_name        => "open-ils.search.biblio.metarecord.mods_slim.batch.retrieve");
@@ -881,16 +900,7 @@ sub biblio_mrid_to_record_ids {
 
 
        my $mrmaps = OpenILS::Application::AppUtils->simple_scalar_request( 
-                       "open-ils.storage", 
-                       #"open-ils.storage.direct.metabib.metarecord_source_map.search.metarecord", $mrid );
-                       $method, 
-                       $mrid, $format );
-
-
-       #my @ids;
-       #for my $map (@$mrmaps) { push @ids, $map->source(); }
-       #warn "Recovered id's [@ids] for mr $mrid\n";
-       #my $size = @ids;
+                       "open-ils.storage", $method, $mrid, $format );
 
        use Data::Dumper;
        warn Dumper $mrmaps;
@@ -902,7 +912,6 @@ sub biblio_mrid_to_record_ids {
 }
 
 
-
 __PACKAGE__->register_method(
        method  => "biblio_record_to_marc_html",
        api_name        => "open-ils.search.biblio.record.html" );