]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/SearchView.pm
note the source code is AGPL for cloning
[public-inbox.git] / lib / PublicInbox / SearchView.pm
index da31109357a0a579fa5c6aa04cb1bf2d1a59c4c1..ebeb41f7a153ffbd69d137600261a85d5ea5d14e 100644 (file)
@@ -148,7 +148,6 @@ sub mset_thread {
                my $i = $_;
                my $m = PublicInbox::SearchMsg->load_doc($i->get_document);
                $pct{$m->mid} = $i->get_percent;
-               $m = $m->mini_mime;
                $m;
        } ($mset->items);
 
@@ -156,10 +155,10 @@ sub mset_thread {
        $th->thread;
        if ($q->{r}) { # order by relevance
                $th->order(sub {
-                       sort { (eval { $pct{$b->topmost->messageid} } || 0)
+                       [ sort { (eval { $pct{$b->topmost->{id}} } || 0)
                                        <=>
-                               (eval { $pct{$a->topmost->messageid} } || 0)
-                       } @_;
+                               (eval { $pct{$a->topmost->{id}} } || 0)
+                       } @{$_[0]} ];
                });
        } else { # order by time (default for threaded view)
                $th->order(*PublicInbox::View::sort_ts);
@@ -185,8 +184,7 @@ sub mset_thread {
        sub {
                return unless $msgs;
                while ($mime = shift @$msgs) {
-                       my $mid = mid_clean(mid_mime($mime));
-                       $mime = $inbox->msg_by_mid($mid) and last;
+                       $mime = $inbox->msg_by_smsg($mime) and last;
                }
                if ($mime) {
                        $mime = Email::MIME->new($mime);