]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Search.pm
smsg: remove from_mitem
[public-inbox.git] / lib / PublicInbox / Search.pm
index e6200bfb771d5aa8ff8814c4551de63d74138d80..1c6482990d6105be88b3df1999dde848a4d05049 100644 (file)
@@ -324,10 +324,13 @@ sub _enquire_once { # retry_reopen callback
        my $limit = $opts->{limit} || 50;
        my $mset = $enquire->get_mset($offset, $limit);
        return $mset if $opts->{mset};
-       my @msgs = map { PublicInbox::Smsg::from_mitem($_) } $mset->items;
-       return \@msgs unless wantarray;
-
-       ($mset->get_matches_estimated, \@msgs)
+       my $nshard = $self->{nshard} // 1;
+       my $i = 0;
+       my %order = map { mdocid($nshard, $_) => ++$i } $mset->items;
+       my @msgs = sort {
+               $order{$a->{num}} <=> $order{$b->{num}}
+       } @{$self->{over_ro}->get_all(keys %order)};
+       wantarray ? ($mset->get_matches_estimated, \@msgs) : \@msgs;
 }
 
 # read-write