X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FSearchView.pm;h=da31109357a0a579fa5c6aa04cb1bf2d1a59c4c1;hb=172416d1cd465da4242cc744a3f309d307f1311d;hp=d019a0f1431d50cb0bbbec8501d55b8bba4a2f29;hpb=6dde5d1b907daf685b29397160a3d446307118de;p=public-inbox.git diff --git a/lib/PublicInbox/SearchView.pm b/lib/PublicInbox/SearchView.pm index d019a0f1..da311093 100644 --- a/lib/PublicInbox/SearchView.pm +++ b/lib/PublicInbox/SearchView.pm @@ -8,10 +8,10 @@ use warnings; use PublicInbox::SearchMsg; use PublicInbox::Hval qw/ascii_html/; use PublicInbox::View; -use PublicInbox::MID qw(mid2path mid_mime mid_clean); +use PublicInbox::MID qw(mid2path mid_mime mid_clean mid_escape); use Email::MIME; require PublicInbox::Git; -require PublicInbox::Thread; +require PublicInbox::SearchThread; our $LIM = 50; sub noop {} @@ -38,11 +38,11 @@ sub sres_top_html { my $cb; if ($err) { $code = 400; - $ctx->{-html_tip} = '
'.err_txt($ctx, $err).'
'.err_txt($ctx, $err).'
\n[No results found]
\n[No results found]
Results $beg-$end of $total"; + my $rv = "
Results $beg-$end of $total"; my $n = $o + $LIM; if ($n < $total) { @@ -153,7 +152,7 @@ sub mset_thread { $m; } ($mset->items); - my $th = PublicInbox::Thread->new(@m); + my $th = PublicInbox::SearchThread->new(\@m); $th->thread; if ($q->{r}) { # order by relevance $th->order(sub { @@ -191,7 +190,8 @@ sub mset_thread { } if ($mime) { $mime = Email::MIME->new($mime); - return PublicInbox::View::index_entry($mime, $ctx); + return PublicInbox::View::index_entry($mime, $ctx, + scalar @$msgs); } $msgs = undef; $skel .= "\n"; @@ -238,6 +238,7 @@ package PublicInbox::SearchQuery; use strict; use warnings; use PublicInbox::Hval; +use PublicInbox::MID qw(mid_escape); sub new { my ($class, $qp) = @_; @@ -262,7 +263,7 @@ sub qs_html { $self = $tmp; } - my $q = PublicInbox::Hval->new($self->{'q'})->as_href; + my $q = mid_escape($self->{'q'}); $q =~ s/%20/+/g; # improve URL readability my $qs = "q=$q";