]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/SearchView.pm
www: reduce long-lived PublicInbox::Search references
[public-inbox.git] / lib / PublicInbox / SearchView.pm
index 623b16fb22cd0d6282d01d001a16dd367531080e..5d77469ed522bcbf14f09904275860bd876f651b 100644 (file)
@@ -294,8 +294,7 @@ sub mset_thread {
 sub mset_thread_i {
        my ($ctx, $eml) = @_;
        $ctx->zmore($ctx->html_top) if exists $ctx->{-html_tip};
-       $eml and return PublicInbox::View::eml_entry($ctx, $eml,
-                                               scalar @{$ctx->{msgs}});
+       $eml and return PublicInbox::View::eml_entry($ctx, $eml);
        my $smsg = shift @{$ctx->{msgs}} or
                $ctx->zmore(${delete($ctx->{skel})});
        $smsg;
@@ -322,7 +321,6 @@ sub adump {
        my ($cb, $mset, $q, $ctx) = @_;
        $ctx->{items} = [ $mset->items ];
        $ctx->{search_query} = $q; # used by WwwAtomStream::atom_header
-       $ctx->{srch} = $ctx->{-inbox}->search;
        PublicInbox::WwwAtomStream->response($ctx, 200, \&adump_i);
 }
 
@@ -330,8 +328,9 @@ sub adump {
 sub adump_i {
        my ($ctx) = @_;
        while (my $mi = shift @{$ctx->{items}}) {
+               my $srch = $ctx->{-inbox}->search(undef, $ctx) or return;
                my $smsg = eval {
-                       PublicInbox::Smsg::from_mitem($mi, $ctx->{srch});
+                       PublicInbox::Smsg::from_mitem($mi, $srch);
                } or next;
                return $smsg;
        }