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();
}
/* performs the actual search */
-function mresultCollectIds() {
+function mresultCollectIds(method) {
if(getOffset() == 0) {
} 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();
}
"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
__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,
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
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";
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) {
$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");
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;
}
-
__PACKAGE__->register_method(
method => "biblio_record_to_marc_html",
api_name => "open-ils.search.biblio.record.html" );