about summary refs log tree commit homepage
path: root/lib/PublicInbox/SearchView.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/PublicInbox/SearchView.pm')
-rw-r--r--lib/PublicInbox/SearchView.pm5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/PublicInbox/SearchView.pm b/lib/PublicInbox/SearchView.pm
index cfe6dfff..ebeb41f7 100644
--- a/lib/PublicInbox/SearchView.pm
+++ b/lib/PublicInbox/SearchView.pm
@@ -155,8 +155,9 @@ sub mset_thread {
         $th->thread;
         if ($q->{r}) { # order by relevance
                 $th->order(sub {
-                        [ sort { ( $pct{$b->{id}} || 0) <=>
-                                 ( $pct{$a->{id}} || 0)
+                        [ sort { (eval { $pct{$b->topmost->{id}} } || 0)
+                                        <=>
+                                (eval { $pct{$a->topmost->{id}} } || 0)
                         } @{$_[0]} ];
                 });
         } else { # order by time (default for threaded view)