}
sub get_records_and_facets {
- my ($self, $rec_ids, $facet_key, $unapi_args) = @_;
+ my ($self, $rec_ids, $facet_key, $unapi_args, $get_hold_stats) = @_;
$unapi_args ||= {};
$unapi_args->{site} ||= $self->ctx->{aou_tree}->()->shortname;
'open-ils.search.facet_cache.retrieve', $facet_key, 10
) if $facet_key;
+
# gather up the unapi recs
$ses->session_wait(1);
$self->timelog("get_records_and_facets():past session wait");
+ if ($get_hold_stats) {
+ # note: this happens after the batch unapi call to ensure
+ # that @data has the record blobs we're expecting.
+ my $hses = OpenSRF::MultiSession->new(
+ app => 'open-ils.circ',
+ cap => 10, # XXX config
+ success_handler => sub {
+ my($self, $req) = @_;
+ my ($blob) = grep {$_->{id} eq $req->{params}->[0]} @data;
+ $blob->{hold_count} = $req->{response}->[0]->content;
+ }
+ );
+ $hses->request('open-ils.circ.bre.holds.count', $_) for @$rec_ids;
+ $hses->session_wait(1);
+ }
+
my $facets = {};
if ($facet_key) {
my $tmp_facets = $facet_req->gather(1);