Skip to content

Commit 6e1da8f

Browse files
committed
use _doc sorting in latest script
We're scrolling through all latest modules. We don't care about the order, use _doc sorting for better performance.
1 parent 6a50825 commit 6e1da8f

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

lib/MetaCPAN/Script/Latest.pm

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,19 @@ sub run {
139139
'Searching for ' . @$filter . ' of ' . $total . ' modules'
140140
}
141141
if @module_filters > 1;
142-
my $scroll = $self->index->type('file')->query($query)->source( [ qw(
143-
author date distribution download_url module.name release status
144-
) ] )->size(100)->raw->scroll;
142+
143+
my $scroll = $self->es->scroll_helper( {
144+
index => $self->index->name,
145+
type => 'file',
146+
size => 100,
147+
body => {
148+
query => $query,
149+
_source => [
150+
qw(author date distribution download_url module.name release status)
151+
],
152+
sort => '_doc',
153+
},
154+
} );
145155

146156
$found_total += $scroll->total;
147157

0 commit comments

Comments
 (0)