]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/SearchView.pm
searchview: fix uninitialized variable
[public-inbox.git] / lib / PublicInbox / SearchView.pm
index 8932c73da5671429e23ca60cabf9801d296c2f04..07fef40ccccc42b34f46da8c83add5bbf1d79a72 100644 (file)
@@ -34,7 +34,7 @@ sub sres_top_html {
                return PublicInbox::WWW::need($ctx, 'Search');
        my $q = PublicInbox::SearchQuery->new($ctx->{qp});
        my $x = $q->{x};
-       my $o = $q->{o};
+       my $o = $q->{o} // 0;
        my $asc;
        if ($o < 0) {
                $asc = 1;
@@ -82,7 +82,7 @@ retry:
                mset_summary($ctx, $mset, $q); # appends to {-html_tip}
                $html = '';
        }
-       html_oneshot($ctx, $code);
+       html_oneshot($ctx, $code, $html);
 }
 
 # display non-nested search results similar to what users expect from
@@ -134,7 +134,7 @@ sub mset_summary {
                $q->{-min_pct} = $min;
                $q->{-max_pct} = $max;
        }
-       $$res .= search_nav_bot($mset, $q);
+       $$res .= search_nav_bot($ctx, $mset, $q);
        undef;
 }
 
@@ -225,7 +225,7 @@ EOM
 }
 
 sub search_nav_bot { # also used by WwwListing for searching extindex miscidx
-       my ($mset, $q) = @_;
+       my ($ctx, $mset, $q) = @_;
        my $total = $mset->get_matches_estimated;
        my $l = $q->{l};
        my $rv = '</pre><hr><pre id=t>';
@@ -274,9 +274,10 @@ sub search_nav_bot { # also used by WwwListing for searching extindex miscidx
        $rv .= qq{<a\nhref="?$prev"\nrel=prev>prev $pd</a>} if $prev;
 
        my $rev = $q->qs_html(o => $o < 0 ? 0 : -1);
-       $rv .= qq{ | <a\nhref="?$rev">reverse</a>} .
-               q{ | sort options + mbox downloads } .
-               q{<a href=#d>above</a></pre>};
+       $rv .= qq{ | <a\nhref="?$rev">reverse</a>};
+       exists($ctx->{ibx}) and
+               $rv .= q{ | sort options + mbox downloads <a href=#d>above</a></pre>};
+       $rv;
 }
 
 sub sort_relevance {
@@ -301,7 +302,7 @@ sub mset_thread {
        my $rootset = PublicInbox::SearchThread::thread($msgs,
                $r ? \&sort_relevance : \&PublicInbox::View::sort_ds,
                $ctx);
-       my $skel = search_nav_bot($mset, $q).
+       my $skel = search_nav_bot($ctx, $mset, $q).
                "<pre>-- links below jump to the message on this page --\n";
 
        $ctx->{-upfx} = '';