about summary refs log tree commit homepage
path: root/lib/PublicInbox/Search.pm
diff options
context:
space:
mode:
authorEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-02-16 02:59:11 +0000
committerEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-02-16 02:59:11 +0000
commitfc62e40e4e3d00a00377ba26aeca010880158caa (patch)
treef14cc38f1bb2804294565fe6cc3175f21b89428f /lib/PublicInbox/Search.pm
parent777df7d3f08de47c5b905a6ec8e7271fb2c1df9d (diff)
downloadpublic-inbox-fc62e40e4e3d00a00377ba26aeca010880158caa.tar.gz
In general, they are, but there's no way for or general purpose
mail server to enforce that.  This is a step in allowing us
to handle more corner cases which existing lists throw at us.
Diffstat (limited to 'lib/PublicInbox/Search.pm')
-rw-r--r--lib/PublicInbox/Search.pm14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm
index 3ec96ca9..33a1f2d3 100644
--- a/lib/PublicInbox/Search.pm
+++ b/lib/PublicInbox/Search.pm
@@ -56,7 +56,7 @@ my %bool_pfx_internal = (
 );
 
 my %bool_pfx_external = (
-        mid => 'XMID', # uniQue id (Message-ID)
+        mid => 'XMID', # Message-ID (full/exact)
 );
 
 my %prob_prefix = (
@@ -285,7 +285,7 @@ sub lookup_message {
         my ($self, $mid) = @_;
         $mid = mid_clean($mid);
 
-        my $doc_id = $self->find_unique_doc_id('XMID' . $mid);
+        my $doc_id = $self->find_first_doc_id('XMID' . $mid);
         my $smsg;
         if (defined $doc_id) {
                 # raises on error:
@@ -327,6 +327,16 @@ sub find_doc_ids {
         ($db->postlist_begin($termval), $db->postlist_end($termval));
 }
 
+sub find_first_doc_id {
+        my ($self, $termval) = @_;
+
+        my ($begin, $end) = $self->find_doc_ids($termval);
+
+        return undef if $begin->equal($end); # not found
+
+        $begin->get_docid;
+}
+
 # normalize subjects so they are suitable as pathnames for URLs
 # XXX: consider for removal
 sub subject_path {