]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/SearchIdx.pm
extmsg: use Xapian only for partial matches
[public-inbox.git] / lib / PublicInbox / SearchIdx.pm
index 8c3bc2d3ce20ce48267b53381b9dd66b63387ad3..aeb363e03d1d57a7ccd3cc7c1ae408cf98d91a05 100644 (file)
@@ -331,6 +331,13 @@ sub add_message {
 
                foreach my $mid (@$mids) {
                        $tg->index_text($mid, 1, 'XM');
+
+                       # because too many Message-IDs are prefixed with
+                       # "Pine.LNX."...
+                       if ($mid =~ /\w{12,}/) {
+                               my @long = ($mid =~ /(\w{3,}+)/g);
+                               $tg->index_text(join(' ', @long), 1, 'XM');
+                       }
                        $tg->increase_termpos;
                }
                $smsg->{to} = $smsg->{cc} = '';
@@ -551,16 +558,11 @@ sub read_log {
        my %D;
        my $line;
        my $newest;
-       my $mid = '20170114215743.5igbjup6qpsh3jfg@genre.crustytoothpaste.net';
        while (defined($line = <$log>)) {
                if ($line =~ /$addmsg/o) {
                        my $blob = $1;
                        delete $D{$blob} and next;
                        my $mime = do_cat_mail($git, $blob, \$bytes) or next;
-                       my $mids = mids($mime->header_obj);
-                       foreach (@$mids) {
-                               warn "ADD $mid\n" if ($_ eq $mid);
-                       }
                        batch_adjust(\$max, $bytes, $batch_cb, $latest);
                        $add_cb->($self, $mime, $bytes, $blob);
                } elsif ($line =~ /$delmsg/o) {
@@ -574,10 +576,6 @@ sub read_log {
        # get the leftovers
        foreach my $blob (keys %D) {
                my $mime = do_cat_mail($git, $blob, \$bytes) or next;
-               my $mids = mids($mime->header_obj);
-               foreach (@$mids) {
-                       warn "DEL $mid\n" if ($_ eq $mid);
-               }
                $del_cb->($self, $mime);
        }
        $batch_cb->($latest, $newest);