-sub html_start {
- my ($q) = @_;
- my $query = PublicInbox::Hval->new_oneline($q->{q});
-
- my $qh = $query->as_html;
- my $res = "<html><head><title>$qh - search results</title></head>" .
- qq{<body><form\naction="">} .
- qq{<input\nname=q\nvalue="$qh"\ntype=text />};
-
- $res .= qq{<input\ntype=hidden\nname=r />} if $q->{r};
- if (my $x = $q->{x}) {
- my $xh = PublicInbox::Hval->new_oneline($x)->as_html;
- $res .= qq{<input\ntype=hidden\nname=x\nvalue="$xh" />};
+sub adump {
+ my ($cb, $mset, $q, $ctx) = @_;
+ my $fh = $cb->([ 200, ['Content-Type' => 'application/atom+xml']]);
+ my $ibx = $ctx->{-inbox};
+ my $feed_opts = PublicInbox::Feed::get_feedopts($ctx);
+ my $x = ascii_html($q->{'q'});
+ $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);
+ $fh->write($x. PublicInbox::Feed::feed_updated());
+
+ for ($mset->items) {
+ $x = PublicInbox::SearchMsg->load_doc($_->get_document)->mid;
+ $x = mid2path($x);
+ my $s = PublicInbox::Feed::feed_entry($feed_opts, $x, $ibx);
+ $fh->write($s) if defined $s;