Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Return all author info for endpoint /author/by_user/USER
For more reuse in WEB, we need extra info from the author type.
Removing the fields list and returning _source will allow more
use cases.
  • Loading branch information
mickeyn committed Jun 7, 2017
1 parent 2ae2de4 commit d0eda81
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/MetaCPAN/Document/Author.pm
Expand Up @@ -167,16 +167,15 @@ sub by_user {
index => $self->index->name,
type => 'author',
body => {
query => { terms => { user => $users } },
size => 100,
fields => [qw( user pauseid )],
query => { terms => { user => $users } },
size => 100,
}
);
return {} unless $authors->{hits}{total};

my @authors = map {
single_valued_arrayref_to_scalar( $_->{fields} );
$_->{fields}
single_valued_arrayref_to_scalar( $_->{_source} );
$_->{_source}
} @{ $authors->{hits}{hits} };

return { authors => \@authors };
Expand Down

0 comments on commit d0eda81

Please sign in to comment.