]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/SearchView.pm
wwwstream: improve documentation and variable naming
[public-inbox.git] / lib / PublicInbox / SearchView.pm
index cfe6dfffa454d14e55cea7d452a1890873a43b2a..fbba9c4984f03f0a3d08a04d53c8fea730050b27 100644 (file)
@@ -155,8 +155,9 @@ sub mset_thread {
        $th->thread;
        if ($q->{r}) { # order by relevance
                $th->order(sub {
-                       [ sort { ( $pct{$b->{id}} || 0) <=>
-                                ( $pct{$a->{id}} || 0)
+                       [ sort { (eval { $pct{$b->topmost->{id}} } || 0)
+                                       <=>
+                               (eval { $pct{$a->topmost->{id}} } || 0)
                        } @{$_[0]} ];
                });
        } else { # order by time (default for threaded view)
@@ -219,7 +220,7 @@ sub adump {
        $x = qq{$x - search results};
        $feed_opts->{atomurl} = $feed_opts->{url} . '?'. $q->qs_html;
        $feed_opts->{url} .= '?'. $q->qs_html(x => undef);
-       $x = PublicInbox::Feed::atom_header($feed_opts, $x);
+       $x = PublicInbox::Feed::atom_header($feed_opts, "<title>$x</title>");
        $fh->write($x. PublicInbox::Feed::feed_updated());
 
        for ($mset->items) {