From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-3.9 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id D3BA81F9F2 for ; Thu, 1 Apr 2021 12:10:42 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 3/5] lei_store: set_xvmd: don't add if no vmd at all Date: Thu, 1 Apr 2021 17:10:40 +0500 Message-Id: <20210401121042.6456-4-e@80x24.org> In-Reply-To: <20210401121042.6456-1-e@80x24.org> References: <20210401121042.6456-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: 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 | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/lib/PublicInbox/LeiStore.pm b/lib/PublicInbox/LeiStore.pm index 48ab1d76..f2aa45bd 100644 --- a/lib/PublicInbox/LeiStore.pm +++ b/lib/PublicInbox/LeiStore.pm @@ -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); }