]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/SearchView.pm
thread: reinstates stable ordering when ghosts are present
[public-inbox.git] / lib / PublicInbox / SearchView.pm
index cfe6dfffa454d14e55cea7d452a1890873a43b2a..ebeb41f7a153ffbd69d137600261a85d5ea5d14e 100644 (file)
@@ -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)