diff options
author | Eric Wong <e@yhbt.net> | 2020-06-10 07:04:53 +0000 |
---|---|---|
committer | Eric Wong <e@yhbt.net> | 2020-06-13 07:55:45 +0000 |
commit | b782d6f9d2e7fb515b589f0343109ac8681e4e14 (patch) | |
tree | daee611798a505f478c8b2386cbaf4e7015f7642 | |
parent | 601658e48f0e28ca178ef5c4d7eed0e50ef42167 (diff) | |
download | public-inbox-b782d6f9d2e7fb515b589f0343109ac8681e4e14.tar.gz |
We'll need to support searching UID ranges for IMAP, so make sure it's indexed, too.
-rw-r--r-- | lib/PublicInbox/Search.pm | 1 | ||||
-rw-r--r-- | lib/PublicInbox/SearchIdx.pm | 1 | ||||
-rw-r--r-- | t/search.t | 5 |
3 files changed, 7 insertions, 0 deletions
diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm index f2d3b92d..c54cf7b9 100644 --- a/lib/PublicInbox/Search.pm +++ b/lib/PublicInbox/Search.pm @@ -12,6 +12,7 @@ use constant { YYYYMMDD => 1, # Date: header for searching in the WWW UI DT => 2, # Date: YYYYMMDDHHMMSS BYTES => 3, # IMAP RFC822.SIZE + UID => 4, # IMAP UID == NNTP article number == Xapian docid # TODO # REPLYCNT => 4, # IMAP ANSWERED }; diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm index f7462aa7..3df7970e 100644 --- a/lib/PublicInbox/SearchIdx.pm +++ b/lib/PublicInbox/SearchIdx.pm @@ -342,6 +342,7 @@ sub add_xapian ($$$$) { my $dt = strftime('%Y%m%d%H%M%S', @ds); add_val($doc, PublicInbox::Search::DT(), $dt); add_val($doc, PublicInbox::Search::BYTES(), $smsg->{bytes}); + add_val($doc, PublicInbox::Search::UID(), $smsg->{num}); my $tg = term_generator($self); $tg->set_document($doc); @@ -324,6 +324,11 @@ $ibx->with_umask(sub { like($bytes, qr/\A[0-9]+\z/, '$bytes stored as digit'); ok($bytes > 0, '$bytes is > 0'); is($bytes, $smsg->{bytes}, 'bytes Xapian value matches Over'); + + $col = PublicInbox::Search::UID(); + my $uid = PublicInbox::Smsg::get_val($doc, $col); + is($uid, $smsg->{num}, 'UID column matches {num}'); + is($uid, $m->get_docid, 'UID column matches docid'); } $mset = $ro->query('tc:list@example.com', {mset => 1}); |