my $client = shift;
my $bib = shift;
my $ou = shift;
+ my $depth = shift;
my $flesh = shift;
my $paging = shift;
$o_search = { parent_ou => undef };
}
- my $orgs = $_storage->request(
- "open-ils.cstore.direct.actor.org_unit.search",
- $o_search,
- { flesh => 100,
- flesh_fields => { aou => [qw/children/] }
- }
- )->gather(1);
+ my $one_org = $_storage->request(
+ "open-ils.cstore.direct.actor.org_unit.search",
+ $o_search
+ )->gather(1);
- my @ou_ids = tree_walker($orgs, 'children', sub {shift->id}) if $orgs;
+ my $orgs = $_storage->request(
+ 'open-ils.cstore.json_query.atomic',
+ { from => [ 'actor.org_unit_descendants', defined($depth) ? ( $one_org->id, $depth ) : ( $one_org->id ) ] }
+ )->gather(1);
+
+
+ my @ou_ids = map { $_->{id} } @$orgs;
$logger->info("Searching for holdings at orgs [".join(',',@ou_ids)."], based on $ou");
my $site = shift;
$log->info("Creating record feed with params [$real_format, $record_list, $unapi, $site]");
- my $feed = create_record_feed( 'record', $real_format, $record_list, $unapi, $site, $real_format =~ /(-full|-uris)$/o ? 1 : 0 );
+ my $feed = create_record_feed( 'record', $real_format, $record_list, $unapi, $site, undef, $real_format =~ /(-full|-uris)$/o ? 1 : 0 );
$feed->root( "$base/../" );
$feed->lib( $site );
$feed->link( next => $next => $feed->type );
if ($uri =~ m{^tag:[^:]+:([^\/]+)/(\d+)(?:\[([0-9,]+)\])?(?:/(.+))?}o) {
$id = $2;
$paging = $3;
- $lib = uc($4);
+ ($lib,$depth) = split('/', $4);
$type = 'record';
$type = 'metarecord' if ($1 =~ /^metabib/o);
$type = 'isbn' if ($1 =~ /^isbn/o);
$format => [ $id ],
$base,
$lib,
+ $depth,
$flesh_feed,
$paging
);
[ map { $_->target_biblio_record_entry } @{ $bucket->items } ],
$unapi,
$org_unit->[0]->shortname,
+ undef,
$flesh_feed
);
$feed->root($root);
# return 302;
#}
- my $feed = create_record_feed( 'record', $type, $list, $unapi, $org_unit->[0]->shortname, $flesh_feed);
+ my $feed = create_record_feed( 'record', $type, $list, $unapi, $org_unit->[0]->shortname, undef, $flesh_feed);
$feed->root($root);
if ($date) {
[ map { $_->[0] } @{$recs->{ids}} ],
$unapi,
$org,
+ undef,
$flesh_feed
);
my $unapi = shift;
my $lib = uc(shift()) || '-';
+ my $depth = shift;
my $flesh = shift;
$flesh = 1 if (!defined($flesh));
$xml = '';
if ($lib && ($type eq 'marcxml' || $type eq 'atom') && $flesh > 0) {
- my $r = $supercat->request( "open-ils.supercat.$search.holdings_xml.retrieve", $rec, $lib, $flesh_feed, $paging );
+ my $r = $supercat->request( "open-ils.supercat.$search.holdings_xml.retrieve", $rec, $lib, $depth, $flesh_feed, $paging );
while ( !$r->complete ) {
$xml .= join('', map {$_->content} $r->recv);
}