From: Bill Erickson Date: Fri, 14 Feb 2014 17:23:02 +0000 (-0500) Subject: LP#1053397 repair one-hit redirect logic for metarecords X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=c62821619ce2a00128aa9cc4a7b19d6e94f1b4fa;p=evergreen%2Fmasslnc.git LP#1053397 repair one-hit redirect logic for metarecords * Only perform the single-hit redirect if there is only one metarecord search result and the MR only has a single constituent record. * Repair the record id logic so the redirect jumps to the correct record. Signed-off-by: Bill Erickson Signed-off-by: Mike Rylander Signed-off-by: Dan Wells --- 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 26df556347..b2098bdbfa 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm @@ -485,9 +485,17 @@ sub load_rresults { ); $self->timelog("Returned from get_records_and_facets()"); - if ($page == 0) { - # TODO: handle metarecords - my $stat = $self->check_1hit_redirect($rec_ids); + if ($page == 0 and @$rec_ids == 1) { + my $stat = 0; + if ($is_meta) { + # if the MR has a single constituent record, it will + # be in array position 2 of the result blob. + # otherwise, we don't want to redirect anyway. + my $bre_id = $results->{ids}->[0]->[2]; + $stat = $self->check_1hit_redirect([$bre_id]) if $bre_id; + } else { + my $stat = $self->check_1hit_redirect($rec_ids); + } return $stat if $stat; }