From: Bill Erickson Date: Mon, 3 Mar 2014 23:00:03 +0000 (-0500) Subject: web staff: streaming patron search API X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=014e552cc88243eefa4870cc50f4fe2bce6d7266;p=working%2FEvergreen.git web staff: streaming patron search API Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm index 9c9efc490d..1616a53558 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm @@ -1317,9 +1317,25 @@ __PACKAGE__->register_method( method => "patron_adv_search", api_name => "open-ils.actor.patron.search.advanced" ); + +__PACKAGE__->register_method( + method => "patron_adv_search", + api_name => "open-ils.actor.patron.search.advanced.fleshed", + stream => 1, + # TODO: change when opensrf 'bundling' is merged. + # set a relatively small bundle size so the caller can start + # seeing results fairly quickly + max_chunk_size => 4096, # bundling + api_level => 2, + signature => { + desc => q/Returns a stream of fleshed user objects instead of + a pile of identifiers/ + } +); + sub patron_adv_search { - my( $self, $client, $auth, $search_hash, - $search_limit, $search_sort, $include_inactive, $search_ou ) = @_; + my( $self, $client, $auth, $search_hash, $search_limit, + $search_sort, $include_inactive, $search_ou, $flesh_fields) = @_; my $e = new_editor(authtoken=>$auth); return $e->event unless $e->checkauth; @@ -1341,9 +1357,17 @@ sub patron_adv_search { ); } } - return $U->storagereq( + + my $ids = $U->storagereq( "open-ils.storage.actor.user.crazy_search", $search_hash, - $search_limit, $search_sort, $include_inactive, $e->requestor->ws_ou, $search_ou, $opt_boundary); + $search_limit, $search_sort, $include_inactive, + $e->requestor->ws_ou, $search_ou, $opt_boundary); + + return $ids unless $self->api_name =~ /fleshed/; + + $client->respond(new_flesh_user($_, $flesh_fields, $e)) for @$ids; + + return; }