]> Sergey Matveev's repositories - public-inbox.git/commitdiff
lei_store: set_xvmd: don't add if no vmd at all
authorEric Wong <e@80x24.org>
Thu, 1 Apr 2021 12:10:40 +0000 (17:10 +0500)
committerEric Wong <e@80x24.org>
Thu, 1 Apr 2021 18:25:15 +0000 (18:25 +0000)
There's no point in adding vmd information for an external
message if it was never stored and there's no vmd at all.

We also don't need to check _docids_for for similar messages,
either, since we always check lse->kw_changed, first.

lib/PublicInbox/LeiStore.pm

index 48ab1d7657ef274376fde197f84458d2b9838b52..f2aa45bd0d41c4335372e78c5bbd55c8673a1e99 100644 (file)
@@ -307,19 +307,11 @@ sub set_xvmd {
        }
        return unless scalar(keys(%$xoids));
 
-       # see if it was indexed, but with different OID(s)
-       if (my @docids = _docids_for($self, $eml)) {
-               for my $docid (@docids) {
-                       next if $seen{$docid};
-                       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
+       # 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);
        $idx->ipc_do('add_vmd', $smsg->{num}, $vmd);
 }