- # see if it was indexed, but with different OID(s)
- if (my @docids = _docids_for($self, $eml)) {
- for my $docid (@docids) {
- for my $oid (keys %$xoids) {
- $oidx->add_xref3($docid, -1, $oid, '.');
- }
- my $idx = $eidx->idx_shard($docid);
- $idx->ipc_do('set_vmd', $docid, $vmd);
- }
- return;
- }
- # totally unseen
- my $smsg = bless { blob => '' }, 'PublicInbox::Smsg';
- $smsg->{num} = $oidx->adj_counter('eidx_docid', '+');
- # save space for an externals-only message
- my $hdr = $eml->header_obj;
- $smsg->populate($hdr); # sets lines == 0
- $smsg->{bytes} = 0;
- delete @$smsg{qw(From Subject)};
- $smsg->{to} = $smsg->{cc} = $smsg->{from} = '';
- $oidx->add_overview($hdr, $smsg); # subject+references for threading
- $smsg->{subject} = '';
- for my $oid (keys %$xoids) {
- $oidx->add_xref3($smsg->{num}, -1, $oid, '.');
- }
- my $idx = $eidx->idx_shard($smsg->{num});
- $idx->index_eml(PublicInbox::Eml->new("\n\n"), $smsg);
+ # n.b. we don't do _docids_for here, we expect the caller
+ # already checked $lse->kw_changed before calling this sub
+
+ return unless (@{$vmd->{kw} // []}) || (@{$vmd->{L} // []});
+ # totally unseen:
+ my ($smsg, $idx) = _external_only($self, $xoids, $eml);