From 3c9dd6619f825f0515e7e4afa1bd55c99c1a68d3 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 5 Oct 2016 23:47:28 +0000 Subject: thread: fix sorting without topmost This bug was hidden, and we may not be able to efficiently implement a topmost subroutine with the hash-based (vs linked-list) based container for threading in the next commit. --- lib/PublicInbox/SearchView.pm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lib/PublicInbox/SearchView.pm') diff --git a/lib/PublicInbox/SearchView.pm b/lib/PublicInbox/SearchView.pm index ebeb41f7..cfe6dfff 100644 --- a/lib/PublicInbox/SearchView.pm +++ b/lib/PublicInbox/SearchView.pm @@ -155,9 +155,8 @@ sub mset_thread { $th->thread; if ($q->{r}) { # order by relevance $th->order(sub { - [ sort { (eval { $pct{$b->topmost->{id}} } || 0) - <=> - (eval { $pct{$a->topmost->{id}} } || 0) + [ sort { ( $pct{$b->{id}} || 0) <=> + ( $pct{$a->{id}} || 0) } @{$_[0]} ]; }); } else { # order by time (default for threaded view) -- cgit v1.2.3-24-ge0c7