]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/SearchIdx.pm
search: index UID for IMAP search, too
[public-inbox.git] / lib / PublicInbox / SearchIdx.pm
index eb228e6bba7fc9089f1793c51a2370815d345c80..3df7970ebf984252f006056042946425e8ef7335 100644 (file)
@@ -341,6 +341,8 @@ sub add_xapian ($$$$) {
        add_val($doc, PublicInbox::Search::YYYYMMDD(), $yyyymmdd);
        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);
@@ -388,6 +390,7 @@ sub add_message {
 
        # v1 and tests only:
        $smsg->populate($hdr, $self);
+       $smsg->{bytes} //= length($mime->as_string);
 
        eval {
                # order matters, overview stores every possible piece of
@@ -484,7 +487,7 @@ sub remove_by_oid {
        for (; $head != $tail; $head++) {
                my $docid = $head->get_docid;
                my $doc = $db->get_document($docid);
-               my $smsg = PublicInbox::Smsg->wrap($mid);
+               my $smsg = bless { mid => $mid }, 'PublicInbox::Smsg';
                $smsg->load_expand($doc);
                if ($smsg->{blob} eq $oid) {
                        push(@delete, $docid);
@@ -752,10 +755,7 @@ sub _index_sync {
        my $xdb = $self->begin_txn_lazy;
        my $mm = _msgmap_init($self);
        do {
-               if ($xlog) {
-                       close($xlog) or die "git log failed: \$?=$?";
-                       $xlog = undef;
-               }
+               $xlog = undef; # stop previous git-log via SIGPIPE
                $last_commit = _last_x_commit($self, $mm);
                $lx = reindex_from($opts->{reindex}, $last_commit);