]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/SearchView.pm
searchview: show full (&x=t) messages in ascending chronlogical order
[public-inbox.git] / lib / PublicInbox / SearchView.pm
index ccc53abf23e4f5a0a24d4d07b56fc648b857932a..cec87c6ad1c84c891fe41d4eac62ec556e6b3a97 100644 (file)
@@ -13,7 +13,7 @@ use PublicInbox::MID qw(mid2path mid_mime mid_clean mid_escape);
 use PublicInbox::MIME;
 require PublicInbox::Git;
 require PublicInbox::SearchThread;
-our $LIM = 50;
+our $LIM = 200;
 
 sub noop {}
 
@@ -145,15 +145,21 @@ sub search_nav_bot {
        my $o = $q->{o};
        my $end = $o + $nr;
        my $beg = $o + 1;
-       my $rv = "</pre><hr><pre>Results $beg-$end of $total";
+       my $rv = '</pre><hr><pre id=t>';
+       if ($beg <= $end) {
+               $rv .= "Results $beg-$end of $total";
+               $rv .= ' (estimated)' if $end != $total;
+       } else {
+               $rv .= "No more results, only $total";
+       }
        my $n = $o + $LIM;
 
        if ($n < $total) {
                my $qs = $q->qs_html(o => $n);
-               $rv .= qq{, <a\nhref="?$qs"\nrel=next>next</a>}
+               $rv .= qq{  <a\nhref="?$qs"\nrel=next>next</a>}
        }
        if ($o > 0) {
-               $rv .= $n < $total ? '/' : ',      ';
+               $rv .= $n < $total ? '/' : '       ';
                my $p = $o - $LIM;
                my $qs = $q->qs_html(o => ($p > 0 ? $p : 0));
                $rv .= qq{<a\nhref="?$qs"\nrel=prev>prev</a>};
@@ -179,9 +185,9 @@ sub mset_thread {
                $pct{$smsg->mid} = $i->get_percent;
                $smsg;
        } ($mset->items) ]});
-
+       my $r = $q->{r};
        my $rootset = PublicInbox::SearchThread::thread($msgs,
-               $q->{r} ? sort_relevance(\%pct) : *PublicInbox::View::sort_ts);
+               $r ? sort_relevance(\%pct) : *PublicInbox::View::sort_ts);
        my $skel = search_nav_bot($mset, $q). "<pre>";
        my $inbox = $ctx->{-inbox};
        $ctx->{-upfx} = '';
@@ -197,11 +203,11 @@ sub mset_thread {
 
        PublicInbox::View::walk_thread($rootset, $ctx,
                *PublicInbox::View::pre_thread);
-
+       @$msgs = reverse @$msgs if $r;
        my $mime;
        sub {
                return unless $msgs;
-               while ($mime = shift @$msgs) {
+               while ($mime = pop @$msgs) {
                        $mime = $inbox->msg_by_smsg($mime) and last;
                }
                if ($mime) {