about summary refs log tree commit homepage
path: root/lib/PublicInbox/SearchView.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-05-02 03:20:22 +0000
committerEric Wong <e@80x24.org>2016-05-02 17:57:07 +0000
commit16d1d110117a2521fcc3304541c937385febd66b (patch)
treefa69aa37cc5ab1fd2eac4b089cc4e838fcb55bb5 /lib/PublicInbox/SearchView.pm
parent98e024acdb909cd9754ed5f107a0063350c103dd (diff)
downloadpublic-inbox-16d1d110117a2521fcc3304541c937385febd66b.tar.gz
Broken threads should be exposed to hopefully encourage people to
use proper mail clients which set In-Reply-To headers.
Diffstat (limited to 'lib/PublicInbox/SearchView.pm')
-rw-r--r--lib/PublicInbox/SearchView.pm17
1 files changed, 7 insertions, 10 deletions
diff --git a/lib/PublicInbox/SearchView.pm b/lib/PublicInbox/SearchView.pm
index 41d32007..c0cd1ffd 100644
--- a/lib/PublicInbox/SearchView.pm
+++ b/lib/PublicInbox/SearchView.pm
@@ -11,6 +11,7 @@ use PublicInbox::View;
 use PublicInbox::MID qw(mid2path mid_clean mid_mime);
 use Email::MIME;
 require PublicInbox::Git;
+require PublicInbox::Thread;
 our $LIM = 50;
 
 sub sres_top_html {
@@ -151,23 +152,19 @@ sub tdump {
         } ($mset->items);
 
         my @rootset;
-        my $th = PublicInbox::View::thread_results(\@m, 0, $q->{r});
-        if ($q->{r}) {
+        my $th = PublicInbox::Thread->new(@m);
+        $th->thread;
+        if ($q->{r}) { # order by relevance
                 $th->order(sub {
                         sort { (eval { $pct{$b->topmost->messageid} } || 0)
                                         <=>
                                 (eval { $pct{$a->topmost->messageid} } || 0)
                         } @_;
                 });
-                @rootset = $th->rootset;
-        } else {
-                @rootset = sort {
-                        (eval { $b->topmost->message->header('X-PI-TS') } || 0)
-                                <=>
-                        (eval { $a->topmost->message->header('X-PI-TS') } || 0)
-                } $th->rootset;
+        } else { # order by time (default for threaded view)
+                $th->order(*PublicInbox::View::sort_ts);
         }
-
+        @rootset = $th->rootset;
         my $git = $ctx->{git} ||= PublicInbox::Git->new($ctx->{git_dir});
         my $state = {
                 ctx => $ctx,