diff options
author | Eric Wong <e@80x24.org> | 2020-10-27 07:54:12 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2020-11-07 10:18:40 +0000 |
commit | ff760861406b8e6319d0229f743e44283e925296 (patch) | |
tree | 01d2379d6fb48737fa2c115ed83a27bf4805fa34 /lib/PublicInbox/SearchIdxShard.pm | |
parent | 71b32a3eb1419d8391b5e7e4bae4046d879f91e4 (diff) | |
download | public-inbox-ff760861406b8e6319d0229f743e44283e925296.tar.gz |
We don't need to keep it in code paths which are guaranteed to only see PublicInbox::Eml (and not Email::MIME or PublicInbox::MIME which did not round-trip properly). However, we must set {raw_bytes} since PublicInbox::Eml may add an extra "\n" for rare messages with no bodies.
Diffstat (limited to 'lib/PublicInbox/SearchIdxShard.pm')
-rw-r--r-- | lib/PublicInbox/SearchIdxShard.pm | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/PublicInbox/SearchIdxShard.pm b/lib/PublicInbox/SearchIdxShard.pm index 8e24aa1b..8ff9ab8b 100644 --- a/lib/PublicInbox/SearchIdxShard.pm +++ b/lib/PublicInbox/SearchIdxShard.pm @@ -107,13 +107,15 @@ sub shard_worker_loop ($$$$$) { sub index_raw { my ($self, $msgref, $eml, $smsg) = @_; if (my $w = $self->{w}) { + $msgref //= \($eml->as_string); + $smsg->{raw_bytes} //= length($$msgref); # mid must be last, it can contain spaces (but not LF) print $w join(' ', @$smsg{qw(raw_bytes bytes num blob ds ts tid mid)}), "\n", $$msgref or die "failed to write shard $!\n"; } else { if ($eml) { - undef $$msgref; + undef($$msgref) if $msgref; } else { # --xapian-only + --sequential-shard: $eml = PublicInbox::Eml->new($msgref); } |