-
- my $th = PublicInbox::SearchThread->new($msgs);
- $th->thread;
- if ($q->{r}) { # order by relevance
- $th->order(sub {
- [ sort { (eval { $pct{$b->topmost->{id}} } || 0)
- <=>
- (eval { $pct{$a->topmost->{id}} } || 0)
- } @{$_[0]} ];
- });
- } else { # order by time (default for threaded view)
- $th->order(*PublicInbox::View::sort_ts);
- }
+ my $r = $q->{r};
+ my $rootset = PublicInbox::SearchThread::thread($msgs,
+ $r ? sort_relevance(\%pct) : *PublicInbox::View::sort_ts);