]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/SearchIdx.pm
replace most uses of PublicInbox::MIME with Eml
[public-inbox.git] / lib / PublicInbox / SearchIdx.pm
index 25118f436139baab6fbfd5c3df13700e92e2241f..4bdd69f540b58e769499e5abd72f8349293712ed 100644 (file)
@@ -10,7 +10,7 @@ package PublicInbox::SearchIdx;
 use strict;
 use warnings;
 use base qw(PublicInbox::Search PublicInbox::Lock);
-use PublicInbox::MIME;
+use PublicInbox::Eml;
 use PublicInbox::InboxWritable;
 use PublicInbox::MID qw/mid_clean mid_mime mids_for_index/;
 use PublicInbox::MsgIter;
@@ -277,7 +277,7 @@ sub index_diff ($$$) {
 }
 
 sub index_xapian { # msg_iter callback
-       my $part = $_[0]->[0]; # ignore $depth and @idx
+       my $part = $_[0]->[0]; # ignore $depth and $idx
        my ($self, $doc) = @{$_[1]};
        my $ct = $part->content_type || 'text/plain';
        my $fn = $part->filename;
@@ -352,6 +352,12 @@ sub add_xapian ($$$$) {
                }
        }
        $doc->add_boolean_term('Q' . $_) foreach @$mids;
+       for my $l ($hdr->header_raw('List-Id')) {
+               $l =~ /<([^>]+)>/ or next;
+               my $lid = $1;
+               $doc->add_boolean_term('G' . $lid);
+               index_text($self, $lid, 1, 'XL'); # probabilistic
+       }
        $self->{xdb}->replace_document($smsg->{num}, $doc);
 }
 
@@ -365,7 +371,7 @@ sub _msgmap_init ($) {
 }
 
 sub add_message {
-       # mime = Email::MIME object
+       # mime = PublicInbox::Eml or Email::MIME object
        my ($self, $mime, $smsg) = @_;
        my $hdr = $mime->header_obj;
        my $mids = mids_for_index($hdr);
@@ -554,7 +560,7 @@ sub do_cat_mail {
        my ($git, $blob, $sizeref) = @_;
        my $str = $git->cat_file($blob, $sizeref) or
                die "BUG: $blob not found in $git->{git_dir}";
-       PublicInbox::MIME->new($str);
+       PublicInbox::Eml->new($str);
 }
 
 # called by public-inbox-index