From 3f2d9e30255824da52bca422d07e97e0859500e2 Mon Sep 17 00:00:00 2001 From: "Eric Wong (Contractor, The Linux Foundation)" Date: Sat, 3 Mar 2018 04:00:09 +0000 Subject: searchidx: support indexing multiple MIDs It's possible to have a message handle multiple terms; so use this feature to ensure messages with multiple MIDs can be found by either one. --- t/v2writable.t | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 't') diff --git a/t/v2writable.t b/t/v2writable.t index bc2437a8..44191c13 100644 --- a/t/v2writable.t +++ b/t/v2writable.t @@ -80,5 +80,18 @@ ok($im->add($mime), 'ordinary message added'); is(scalar(@mids), 1, 'new generated'); } -$im->done; +{ + $mime->header_set('Message-Id', '', ''); + ok($im->add($mime), 'message with multiple Message-ID'); + $im->done; + my @found; + $ibx->search->each_smsg_by_mid('abcde@1', sub { push @found, @_; 1 }); + is(scalar(@found), 1, 'message found by first MID'); + $ibx->search->each_smsg_by_mid('abcde@2', sub { push @found, @_; 1 }); + is(scalar(@found), 2, 'message found by second MID'); + is($found[0]->{doc_id}, $found[1]->{doc_id}, 'same document'); + ok($found[1]->{doc_id} > 0, 'doc_id is positive'); +} + + done_testing(); -- cgit v1.2.3-24-ge0c7