From: Bill Erickson Date: Wed, 27 Jul 2011 18:40:46 +0000 (-0400) Subject: Metarecord list on results page X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=161a58e33efb65920782e4be78616e8a8b3a8f33;p=evergreen%2Fequinox.git Metarecord list on results page Added a new ?metarecord= param to opac/results page to list records associated with a given metarecord ID. This is used as page 2 of the (pending) metarecord search process as well 'show in catalog' for embedded staff client metarecord holds. Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm index 787228c906..d445250449 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm @@ -48,7 +48,7 @@ sub _prepare_biblio_search_basics { sub _prepare_biblio_search { my ($cgi, $ctx) = @_; - my $query = _prepare_biblio_search_basics($cgi); + my $query = _prepare_biblio_search_basics($cgi) || ''; $query = ('#' . $_ . ' ' . $query) foreach ($cgi->param('modifier')); @@ -135,37 +135,52 @@ sub load_rresults { my $page = $cgi->param('page') || 0; my $facet = $cgi->param('facet'); my $limit = $self->_get_search_limit; - my $loc = $cgi->param('loc'); + my $loc = $cgi->param('loc') || $ctx->{aou_tree}->()->id; my $offset = $page * $limit; + my $metarecord = $cgi->param('metarecord'); + my $results; my ($query, $site, $depth) = _prepare_biblio_search($cgi, $ctx); - return $self->generic_redirect unless $query; + if ($metarecord) { - # Limit and offset will stay here. Everything else should be part of - # the query string, not special args. - my $args = {'limit' => $limit, 'offset' => $offset}; + # TODO: other limits, like SVF/format, etc. + $results = $U->simplereq( + 'open-ils.search', + 'open-ils.search.biblio.metarecord_to_records', + $metarecord, {org => $loc, depth => $depth} + ); + + # force the metarecord result blob to match the format of regular search results + $results->{ids} = [map { [$_] } @{$results->{ids}}]; + + } else { - # Stuff these into the TT context so that templates can use them in redrawing forms - $ctx->{processed_search_query} = $query; + return $self->generic_redirect unless $query; - $query = "$query $facet" if $facet; # TODO + # Limit and offset will stay here. Everything else should be part of + # the query string, not special args. + my $args = {'limit' => $limit, 'offset' => $offset}; - $logger->activity("EGWeb: [search] $query"); + # Stuff these into the TT context so that templates can use them in redrawing forms + $ctx->{processed_search_query} = $query; - my $results; + $query = "$query $facet" if $facet; # TODO - try { + $logger->activity("EGWeb: [search] $query"); - my $method = 'open-ils.search.biblio.multiclass.query'; - $method .= '.staff' if $ctx->{is_staff}; - $results = $U->simplereq('open-ils.search', $method, $args, $query, 1); + try { - } catch Error with { - my $err = shift; - $logger->error("multiclass search error: $err"); - $results = {count => 0, ids => []}; - }; + my $method = 'open-ils.search.biblio.multiclass.query'; + $method .= '.staff' if $ctx->{is_staff}; + $results = $U->simplereq('open-ils.search', $method, $args, $query, 1); + + } catch Error with { + my $err = shift; + $logger->error("multiclass search error: $err"); + $results = {count => 0, ids => []}; + }; + } my $rec_ids = [map { $_->[0] } @{$results->{ids}}];