]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/SearchView.pm
wwwstream: reduce object graph depth
[public-inbox.git] / lib / PublicInbox / SearchView.pm
index 287b0a280575885f9c51678e80ed8b7ea277bc6d..71c3ae707bbfe4fc39d1b02f4f24a2dbc99931f3 100644 (file)
@@ -6,7 +6,7 @@ package PublicInbox::SearchView;
 use strict;
 use warnings;
 use URI::Escape qw(uri_unescape uri_escape);
-use PublicInbox::SearchMsg;
+use PublicInbox::Smsg;
 use PublicInbox::Hval qw(ascii_html obfuscate_addrs mid_href);
 use PublicInbox::View;
 use PublicInbox::WwwAtomStream;
@@ -82,7 +82,7 @@ retry:
                        $cb = mset_summary($ctx, $mset, $q);
                }
        }
-       PublicInbox::WwwStream->response($ctx, $code, $cb);
+       PublicInbox::WwwStream::response($ctx, $code, $cb);
 }
 
 # display non-nested search results similar to what users expect from
@@ -100,7 +100,7 @@ sub mset_summary {
        foreach my $m ($mset->items) {
                my $rank = sprintf("%${pad}d", $m->get_rank + 1);
                my $pct = get_pct($m);
-               my $smsg = PublicInbox::SearchMsg::from_mitem($m, $srch);
+               my $smsg = PublicInbox::Smsg::from_mitem($m, $srch);
                unless ($smsg) {
                        eval {
                                $m = "$m ".$m->get_docid . " expired\n";
@@ -243,8 +243,8 @@ sub search_nav_bot {
 
 sub sort_relevance {
        [ sort {
-               (eval { $b->topmost->{smsg}->{pct} } // 0) <=>
-               (eval { $a->topmost->{smsg}->{pct} } // 0)
+               (eval { $b->topmost->{pct} } // 0) <=>
+               (eval { $a->topmost->{pct} } // 0)
        } @{$_[0]} ]
 }
 
@@ -260,7 +260,7 @@ sub load_msgs {
        my ($mset) = @_;
        [ map {
                my $mi = $_;
-               my $smsg = PublicInbox::SearchMsg::from_mitem($mi);
+               my $smsg = PublicInbox::Smsg::from_mitem($mi);
                $smsg->{pct} = get_pct($mi);
                $smsg;
        } ($mset->items) ]
@@ -300,8 +300,8 @@ sub mset_thread_i {
        my ($nr, $ctx) = @_;
        my $msgs = $ctx->{msgs} or return;
        while (my $smsg = pop @$msgs) {
-               $ctx->{-inbox}->smsg_mime($smsg) or next;
-               return PublicInbox::View::index_entry($smsg, $ctx,
+               my $eml = $ctx->{-inbox}->smsg_eml($smsg) or next;
+               return PublicInbox::View::eml_entry($ctx, $smsg, $eml,
                                                        scalar @$msgs);
        }
        my ($skel) = delete @$ctx{qw(skel msgs)};
@@ -338,9 +338,9 @@ sub adump_i {
        my ($ctx) = @_;
        while (my $mi = shift @{$ctx->{items}}) {
                my $smsg = eval {
-                       PublicInbox::SearchMsg::from_mitem($mi, $ctx->{srch});
+                       PublicInbox::Smsg::from_mitem($mi, $ctx->{srch});
                } or next;
-               $ctx->{-inbox}->smsg_mime($smsg) and return $smsg;
+               return $smsg;
        }
 }