Skip to content

Commit

Permalink
use _doc sorting in latest script
Browse files Browse the repository at this point in the history
We're scrolling through all latest modules. We don't care about the
order, use _doc sorting for better performance.
  • Loading branch information
haarg committed Oct 1, 2024
1 parent 6a50825 commit 6e1da8f
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions lib/MetaCPAN/Script/Latest.pm
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,19 @@ sub run {
'Searching for ' . @$filter . ' of ' . $total . ' modules'
}
if @module_filters > 1;
my $scroll = $self->index->type('file')->query($query)->source( [ qw(
author date distribution download_url module.name release status
) ] )->size(100)->raw->scroll;

my $scroll = $self->es->scroll_helper( {
index => $self->index->name,
type => 'file',
size => 100,
body => {
query => $query,
_source => [
qw(author date distribution download_url module.name release status)
],
sort => '_doc',
},
} );

$found_total += $scroll->total;

Expand Down

0 comments on commit 6e1da8f

Please sign in to comment.