@@ -2,7 +2,8 @@ package MetaCPAN::Query::Release;
22
33use MetaCPAN::Moose;
44
5- use MetaCPAN::Util qw( single_valued_arrayref_to_scalar true false ) ;
5+ use MetaCPAN::Util
6+ qw( hit_total single_valued_arrayref_to_scalar true false ) ;
67
78with ' MetaCPAN::Query::Role::Common' ;
89
@@ -184,7 +185,7 @@ sub get_contributors {
184185 }
185186 );
186187
187- if ( $check_author -> { hits }{ total } ) {
188+ if ( hit_total( $check_author ) ) {
188189 $contrib -> {pauseid }
189190 = uc $check_author -> {hits }{hits }[0]{_source }{pauseid };
190191 }
@@ -365,7 +366,7 @@ sub by_author_and_name {
365366 return {
366367 took => $ret -> {took },
367368 release => $data ,
368- total => $ret -> { hits }{ total }
369+ total => hit_total( $ret ),
369370 };
370371}
371372
@@ -412,7 +413,7 @@ sub by_author_and_names {
412413
413414 return {
414415 took => $ret -> {took },
415- total => $ret -> { hits }{ total } ,
416+ total => hit_total( $ret ) ,
416417 releases => \@releases ,
417418 };
418419}
@@ -450,7 +451,7 @@ sub by_author {
450451
451452 return {
452453 releases => $data ,
453- total => $ret -> { hits }{ total } ,
454+ total => hit_total( $ret ) ,
454455 took => $ret -> {took }
455456 };
456457}
@@ -486,7 +487,7 @@ sub latest_by_distribution {
486487 return {
487488 release => $data ,
488489 took => $ret -> {took },
489- total => $ret -> { hits }{ total }
490+ total => hit_total( $ret ),
490491 };
491492}
492493
@@ -546,7 +547,7 @@ sub all_by_author {
546547 return {
547548 took => $ret -> {took },
548549 releases => $data ,
549- total => $ret -> { hits }{ total }
550+ total => hit_total( $ret ),
550551 };
551552}
552553
@@ -617,7 +618,7 @@ sub versions {
617618
618619 return {
619620 releases => $data ,
620- total => $ret -> { hits }{ total } ,
621+ total => hit_total( $ret ) ,
621622 took => $ret -> {took }
622623 };
623624}
@@ -812,7 +813,7 @@ sub _get_depended_releases {
812813
813814 return +{
814815 data => [ map { $_ -> {_source } } @{ $depended -> {hits }{hits } } ],
815- total => $depended -> { hits }{ total } ,
816+ total => hit_total( $depended ) ,
816817 took => $depended -> {took },
817818 };
818819}
@@ -880,7 +881,7 @@ sub recent {
880881
881882 return {
882883 releases => $data ,
883- total => $ret -> { hits }{ total } ,
884+ total => hit_total( $ret ) ,
884885 took => $ret -> {took }
885886 };
886887}
@@ -969,7 +970,7 @@ sub modules {
969970
970971 return {
971972 files => \@files ,
972- total => $ret -> { hits }{ total } ,
973+ total => hit_total( $ret ) ,
973974 took => $ret -> {took }
974975 };
975976}
@@ -1153,7 +1154,7 @@ sub find_download_url {
11531154 search_type => ' dfs_query_then_fetch' ,
11541155 );
11551156
1156- return unless $res -> { hits }{ total } ;
1157+ return unless hit_total( $res ) ;
11571158
11581159 my @checksums ;
11591160
0 commit comments