about summary refs log tree commit homepage
path: root/t/lei_xsearch.t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-03-13 15:40:27 +0000
committerEric Wong <e@80x24.org>2021-03-13 18:39:36 -0400
commit64b557420689476493d752968d99ab8ae62bad9a (patch)
tree0987e5bf1a1028adc065d5691ed9ee9d9d0142bd /t/lei_xsearch.t
parent037cc7637baf074b9dc14a67a629940ae84375d9 (diff)
downloadpublic-inbox-64b557420689476493d752968d99ab8ae62bad9a.tar.gz
This fixes "m:", "l:", "f:", "t:", "c:", "dfn:", and "n:" search
prefixes under indexlevel=medium when mixed with indexlevel=full
inboxish.  We need positional data for Message-IDs, List-Id,
email addresses and filenames for exact matches, though we still
want to support wildcards.

Fortunately the storage cost is still small as these prefixes
tend to be small compared to message bodies.  These are NOT
boolean terms since wildcard support and partial matching is
desired.
Diffstat (limited to 't/lei_xsearch.t')
-rw-r--r--t/lei_xsearch.t31
1 files changed, 31 insertions, 0 deletions
diff --git a/t/lei_xsearch.t b/t/lei_xsearch.t
index f865ff43..5bfbcfe6 100644
--- a/t/lei_xsearch.t
+++ b/t/lei_xsearch.t
@@ -78,4 +78,35 @@ is(scalar(@ibxish), scalar(@ibx) + 1, 'got locals back');
 is($lxs->search, $lxs, '->search works');
 is($lxs->over, undef, '->over fails');
 
+{
+        $lxs = PublicInbox::LeiXSearch->new;
+        my $v2ibx = PublicInbox::InboxWritable->new({
+                inboxdir => "$home/v2full",
+                name => 'v2full',
+                version => 2,
+                indexlevel => 'full',
+                -primary_address => 'v2full@example.com',
+        }, {});
+        my $im = $v2ibx->importer(0);
+        $im->add(eml_load('t/plack-qp.eml'));
+        $im->done;
+        my $v1ibx = PublicInbox::InboxWritable->new({
+                inboxdir => "$home/v1medium",
+                name => 'v1medium',
+                version => 1,
+                indexlevel => 'medium',
+                -primary_address => 'v1medium@example.com',
+        }, {});
+        $im = $v1ibx->importer(0);
+        $im->add(eml_load('t/utf8.eml'));
+        $im->done;
+        $lxs->prepare_external($v1ibx);
+        $lxs->prepare_external($v2ibx);
+        for my $loc ($lxs->locals) {
+                $lxs->attach_external($loc);
+        }
+        my $mset = $lxs->mset('m:testmessage@example.com');
+        is($mset->size, 1, 'got m: match on medium+full XSearch mix');
+}
+
 done_testing;