From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id AD4D41F519; Wed, 18 Apr 2018 09:13:19 +0000 (UTC) From: "Eric Wong (Contractor, The Linux Foundation)" To: meta@public-inbox.org Cc: "Eric Wong (Contractor, The Linux Foundation)" Subject: [PATCH 05/12] search: preserve References in Xapian smsg for x=t view Date: Wed, 18 Apr 2018 09:13:09 +0000 Message-Id: <20180418091316.29114-6-e@80x24.org> In-Reply-To: <20180418091316.29114-1-e@80x24.org> References: <20180418091316.29114-1-e@80x24.org> List-Id: I'm not sure how useful this view is, but it exists for now. --- lib/PublicInbox/SearchIdx.pm | 1 + t/psgi_v2.t | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm index fd76627..0b1dc21 100644 --- a/lib/PublicInbox/SearchIdx.pm +++ b/lib/PublicInbox/SearchIdx.pm @@ -331,6 +331,7 @@ sub add_message { $tg->index_text($mid, 1, 'XM'); } $smsg->{to} = $smsg->{cc} = ''; + PublicInbox::OverIdx::parse_references($smsg, $mid0, $mids); my $data = $smsg->to_doc_data($oid, $mid0); $doc->set_data($data); if (my $altid = $self->{-altid}) { diff --git a/t/psgi_v2.t b/t/psgi_v2.t index faa139f..65448dc 100644 --- a/t/psgi_v2.t +++ b/t/psgi_v2.t @@ -113,6 +113,7 @@ test_psgi(sub { $www->call(@_) }, sub { like($raw, qr/^hello ghosts$/m, 'got third message'); @from_ = ($raw =~ m/^From /mg); is(scalar(@from_), 3, 'three From_ lines'); + $config->each_inbox(sub { $_[0]->search->reopen }); SKIP: { eval { require IO::Uncompress::Gunzip }; @@ -129,7 +130,6 @@ test_psgi(sub { $www->call(@_) }, sub { is(scalar(@from_), 3, 'three From_ lines in t.mbox.gz'); # search interface - $config->each_inbox(sub { $_[0]->search->reopen }); $res = $cb->(POST('/v2test/?q=m:a-mid@b&x=m')); $in = $res->content; $status = IO::Uncompress::Gunzip::gunzip(\$in => \$out); @@ -150,6 +150,13 @@ test_psgi(sub { $www->call(@_) }, sub { is(scalar(@from_), 3, 'three From_ lines in all.mbox'); }; + $res = $cb->(GET('/v2test/?q=m:a-mid@b&x=t')); + is($res->code, 200, 'success with threaded search'); + my $raw = $res->content; + ok($raw =~ s/\A.*>Results 1-3 of 3(GET('/v2test/a-mid@b/')); $raw = $res->content; @@ -183,7 +190,7 @@ test_psgi(sub { $www->call(@_) }, sub { $res = $cb->(GET('/v2test/reuse@mid/T/')); $raw = $res->content; like($raw, qr/\b4\+ messages\b/, 'thread overview shown with /T/'); - my @over = ($raw =~ m/^\d{4}-\d+-\d+\s+\d+:\d+ (.+)$/gm); + @over = ($raw =~ m/^\d{4}-\d+-\d+\s+\d+:\d+ (.+)$/gm); is_deeply(\@over, [ '