From: Mike Rylander Date: Wed, 3 Feb 2016 17:26:53 +0000 (-0500) Subject: LP#1549505: Surface badge list and popularity in the result data X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=e30ce5c1fd16396f9f3391a7bcd1452ed7f5161b;p=working%2FEvergreen.git LP#1549505: Surface badge list and popularity in the result data Signed-off-by: Mike Rylander Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm index 1e6a485121..b523e80fda 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm @@ -1364,9 +1364,9 @@ sub staged_search { # Create backwards-compatible result structures if($IAmMetabib) { - $results = [map {[$_->{id}, $_->{rel}, $_->{record}]} @$results]; + $results = [map {[$_->{id}, $_->{badges}, $_->{popularity}, $_->{rel}, $_->{record}]} @$results]; } else { - $results = [map {[$_->{id}]} @$results]; + $results = [map {[$_->{id}, $_->{badges}, $_->{popularity}]} @$results]; } push @$new_ids, grep {defined($_)} map {$_->[0]} @$results; 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 ecd1bad8ae..1234177d50 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm @@ -519,13 +519,15 @@ sub load_rresults { } } - if ($tag_circs) { - for my $rec (@{$ctx->{records}}) { - my ($res_rec) = grep { $_->[0] == $rec->{$id_key} } @{$results->{ids}}; - # index 1 in the per-record result array is a boolean which + for my $rec (@{$ctx->{records}}) { + my ($res_rec) = grep { $_->[0] == $rec->{$id_key} } @{$results->{ids}}; + $rec->{badges} = [split(',', $res_rec->[1])] if $res_rec->[1]; + $rec->{popularity} = $res_rec->[2]; + if ($tag_circs) { + # index 3 (5 for MR) in the per-record result array is a boolean which # indicates whether the record in question is in the users # accessible circ history list - my $index = $is_meta ? 3 : 1; + my $index = $is_meta ? 5 : 3; $rec->{user_circulated} = 1 if $res_rec->[$index]; } }