Skip to content

Commit

Permalink
Merge pull request #1939 from metacpan/mickey/use_author_by_ids
Browse files Browse the repository at this point in the history
Use /author/by_ids API endpoint
  • Loading branch information
oalders committed Jul 5, 2017
2 parents a6a9571 + 5604c70 commit edcbaa6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 19 deletions.
11 changes: 4 additions & 7 deletions lib/MetaCPAN/Web/Controller/Recent/TopUploaders.pm
Expand Up @@ -33,13 +33,10 @@ sub topuploaders : Private {
$c->stash(
{
authors => [
sort { $b->{releases} <=> $a->{releases} } map {
{
%{ $_->{_source} },
releases =>
$data->{counts}{ $_->{_source}->{pauseid} }
}
} @{ $authors->{hits}{hits} }
sort { $b->{releases} <=> $a->{releases} }
map +{ %{$_},
releases => $data->{counts}{ $_->{pauseid} } },
@{ $authors->{authors} }
],
took => $data->{took},
total => $data->{total},
Expand Down
13 changes: 1 addition & 12 deletions lib/MetaCPAN/Web/Model/API/Author.pm
Expand Up @@ -32,18 +32,7 @@ sub get {
return $self->request( '/author/' . uc( $author[0] ) )
if ( @author == 1 );

return $self->request(
'/author/_search',
{
query => {
constant_score => {
filter => { ids => { values => [ map {uc} @author ] } }
}
},
size => scalar @author,
}
);

return $self->request( '/author/by_ids', { id => \@author } );
}

sub search {
Expand Down

0 comments on commit edcbaa6

Please sign in to comment.