From aad1b9e70529b78d3d7d62b0920ad82ca40f9592 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 22 Aug 2020 06:06:26 +0000 Subject: search: support downloading mboxes results with full thread Finally, the addition of THREADID for collapsing results in Xapian lets us emulate the "mairix --threads" feature. That is, instead of returning only the matching messages, the entire thread is included in the downloaded mbox.gz This requires a "public-inbox-index --reindex" to be usable. --- lib/PublicInbox/SearchQuery.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lib/PublicInbox/SearchQuery.pm') diff --git a/lib/PublicInbox/SearchQuery.pm b/lib/PublicInbox/SearchQuery.pm index ce1eae12..6724ae39 100644 --- a/lib/PublicInbox/SearchQuery.pm +++ b/lib/PublicInbox/SearchQuery.pm @@ -12,7 +12,8 @@ our $LIM = 200; sub new { my ($class, $qp) = @_; - my $r = $qp->{r}; + my $r = $qp->{r}; # relevance + my $t = $qp->{t}; # collapse threads my ($l) = (($qp->{l} || '') =~ /([0-9]+)/); $l = $LIM if !$l || $l > $LIM; bless { @@ -21,6 +22,7 @@ sub new { o => (($qp->{o} || '0') =~ /(-?[0-9]+)/), l => $l, r => (defined $r && $r ne '0'), + t => (defined $t && $t ne '0'), }, $class; } @@ -41,8 +43,8 @@ sub qs_html { if (my $l = $self->{l}) { $qs .= "&l=$l" unless $l == $LIM; } - if (my $r = $self->{r}) { - $qs .= "&r"; + for my $bool (qw(r t)) { + $qs .= "&$bool" if $self->{$bool}; } if (my $x = $self->{x}) { $qs .= "&x=$x" if ($x eq 't' || $x eq 'A' || $x eq 'm'); -- cgit v1.2.3-24-ge0c7