says the value isn't
- # very meaningful, anyways.
- my $n = $_[0]->get_percent;
- $n > 99 ? 99 : $n;
+ } @{$_[0]};
}
sub mset_thread {
my ($ctx, $mset, $q) = @_;
- my $ibx = $ctx->{-inbox};
- my $nshard = $ibx->search->{nshard} // 1;
- my %pct = map { mdocid($nshard, $_) => get_pct($_) } $mset->items;
- my $msgs = $ibx->over->get_all(keys %pct);
- $_->{pct} = $pct{$_->{num}} for @$msgs;
+ my $ibx = $ctx->{ibx};
+ my @pct = map { get_pct($_) } $mset->items;
+ my $msgs = $ibx->isrch->mset_to_smsg($ibx, $mset);
+ my $i = 0;
+ $_->{pct} = $pct[$i++] for @$msgs;
my $r = $q->{r};
if ($r) { # for descriptions in search_nav_bot
- my @pct = values %pct;
$q->{-min_pct} = min(@pct);
$q->{-max_pct} = max(@pct);
}
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).
+ "-- links below jump to the message on this page --\n";
+
$ctx->{-upfx} = '';
$ctx->{anchor_idx} = 1;
$ctx->{cur_level} = 0;
@@ -322,16 +326,16 @@ sub mset_thread {
@$msgs = reverse @$msgs if $r;
$ctx->{msgs} = $msgs;
- PublicInbox::WwwStream::aresponse($ctx, 200, \&mset_thread_i);
+ PublicInbox::WwwStream::aresponse($ctx, \&mset_thread_i);
}
# callback for PublicInbox::WwwStream::getline
sub mset_thread_i {
my ($ctx, $eml) = @_;
- $ctx->zmore($ctx->html_top) if exists $ctx->{-html_tip};
+ print { $ctx->zfh } $ctx->html_top if exists $ctx->{-html_tip};
$eml and return PublicInbox::View::eml_entry($ctx, $eml);
my $smsg = shift @{$ctx->{msgs}} or
- $ctx->zmore(${delete($ctx->{skel})});
+ print { $ctx->zfh } ${delete($ctx->{skel})};
$smsg;
}
@@ -354,16 +358,16 @@ sub ctx_prepare {
sub adump {
my ($cb, $mset, $q, $ctx) = @_;
- $ctx->{ids} = $ctx->{-inbox}->search->mset_to_artnums($mset);
+ $ctx->{ids} = $ctx->{ibx}->isrch->mset_to_artnums($mset);
$ctx->{search_query} = $q; # used by WwwAtomStream::atom_header
- PublicInbox::WwwAtomStream->response($ctx, 200, \&adump_i);
+ PublicInbox::WwwAtomStream->response($ctx, \&adump_i);
}
# callback for PublicInbox::WwwAtomStream::getline
sub adump_i {
my ($ctx) = @_;
while (my $num = shift @{$ctx->{ids}}) {
- my $smsg = eval { $ctx->{-inbox}->over->get_art($num) } or next;
+ my $smsg = eval { $ctx->{ibx}->over->get_art($num) } or next;
return $smsg;
}
}