From c62821619ce2a00128aa9cc4a7b19d6e94f1b4fa Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Fri, 14 Feb 2014 12:23:02 -0500 Subject: [PATCH] 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 --- .../perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) 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; } -- 2.43.2