about summary refs log tree commit homepage
path: root/lib/PublicInbox/V2Writable.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-01-03 02:06:14 +0000
committerEric Wong <e@80x24.org>2021-01-03 18:30:31 +0000
commit323d8bac125e89a76c904a54a7ae0b2e36f05cc6 (patch)
tree0220aee8cc0b691fe8ca0a54abd2a528288f3e06 /lib/PublicInbox/V2Writable.pm
parent82b805db3ad908f1c3ea114f329835c6f881144a (diff)
downloadpublic-inbox-323d8bac125e89a76c904a54a7ae0b2e36f05cc6.tar.gz
Since Storable and Sereal are designed for lossless
serialization, we'll just pass $eml objects to whatever process
is running SearchIdx.
Diffstat (limited to 'lib/PublicInbox/V2Writable.pm')
-rw-r--r--lib/PublicInbox/V2Writable.pm11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm
index 885edbe9..7b6b93a0 100644
--- a/lib/PublicInbox/V2Writable.pm
+++ b/lib/PublicInbox/V2Writable.pm
@@ -140,11 +140,11 @@ sub idx_shard ($$) {
 
 # indexes a message, returns true if checkpointing is needed
 sub do_idx ($$$$) {
-        my ($self, $msgref, $mime, $smsg) = @_;
+        my ($self, $msgref, $eml, $smsg) = @_;
         $smsg->{bytes} = $smsg->{raw_bytes} + crlf_adjust($$msgref);
-        $self->{oidx}->add_overview($mime, $smsg);
+        $self->{oidx}->add_overview($eml, $smsg);
         my $idx = idx_shard($self, $smsg->{num});
-        $idx->index_raw($msgref, $mime, $smsg);
+        $idx->index_eml($eml, $smsg);
         my $n = $self->{transact_bytes} += $smsg->{raw_bytes};
         $n >= $self->{batch_bytes};
 }
@@ -173,8 +173,7 @@ sub _add {
         $cmt = $im->get_mark($cmt);
         $self->{last_commit}->[$self->{epoch_max}] = $cmt;
 
-        my $msgref = delete $smsg->{-raw_email};
-        if (do_idx($self, $msgref, $mime, $smsg)) {
+        if (do_idx($self, delete $smsg->{-raw_email}, $mime, $smsg)) {
                 $self->checkpoint;
         }
 
@@ -1219,7 +1218,7 @@ sub index_xap_only { # git->cat_async callback
         my $self = $smsg->{self};
         my $idx = idx_shard($self, $smsg->{num});
         $smsg->{raw_bytes} = $size;
-        $idx->index_raw($bref, undef, $smsg);
+        $idx->index_eml(PublicInbox::Eml->new($bref), $smsg);
         $self->{transact_bytes} += $size;
 }