From 47d21e78be57a8f4615be5872e08ec4539423d1f Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 21 Mar 2021 15:50:45 +0600 Subject: lei import: vivify external-only messages Keyword storage for external-only messages was preventing messages from being explicitly imported. Teach lei_store to vivify keyword-only entries into fully-indexed messages on import. --- lib/PublicInbox/Import.pm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'lib/PublicInbox/Import.pm') diff --git a/lib/PublicInbox/Import.pm b/lib/PublicInbox/Import.pm index b8fa5c21..34738279 100644 --- a/lib/PublicInbox/Import.pm +++ b/lib/PublicInbox/Import.pm @@ -413,7 +413,19 @@ sub add { $smsg->{blob} = $self->get_mark(":$blob"); $smsg->set_bytes($raw_email, $n); if (my $oidx = delete $smsg->{-oidx}) { # used by LeiStore - return if $oidx->blob_exists($smsg->{blob}); + my @docids = $oidx->blob_exists($smsg->{blob}); + my @vivify_xvmd; + for my $id (@docids) { + if (my $cur = $oidx->get_art($id)) { + # already imported if bytes > 0 + return if $cur->{bytes} > 0; + push @vivify_xvmd, $id; + } else { + warn "W: $smsg->{blob} ", + "#$id gone (bug?)\n"; + } + } + $smsg->{-vivify_xvmd} = \@vivify_xvmd; } } my $ref = $self->{ref}; -- cgit v1.2.3-24-ge0c7