]> Sergey Matveev's repositories - public-inbox.git/commitdiff
lei/store: do not put NULL into over.num column
authorEric Wong <e@80x24.org>
Fri, 18 Jun 2021 19:20:31 +0000 (19:20 +0000)
committerEric Wong <e@80x24.org>
Fri, 18 Jun 2021 19:23:20 +0000 (19:23 +0000)
Simplify oid2docid and filter out undefined docids in ->add_eml,
instead.  This avoids SQLite "datatype mismatch" errors in
OverIdx->add_over

Fixes: d1052f03ea85d4af ("lei/store: cull redundant docids based on blob OID")
lib/PublicInbox/LeiStore.pm

index 4ba1e647dde82afd9c39f6c31c841216182e5923..e26b622d51279cb08488ddebd96f286a18ee57eb 100644 (file)
@@ -269,7 +269,7 @@ W: $oid indexed as multiple docids: $docid @cull, culling to fixup old bugs
 EOF
                remove_docids($self, @cull);
        }
-       wantarray ? ($docid) : $docid;
+       $docid;
 }
 
 sub add_eml {
@@ -292,8 +292,8 @@ sub add_eml {
                if (scalar keys %$xoids) {
                        my %docids = map { $_ => 1 } @$vivify_xvmd;
                        for my $oid (keys %$xoids) {
-                               my @id = oid2docid($self, $oid);
-                               @docids{@id} = @id;
+                               my $docid = oid2docid($self, $oid);
+                               $docids{$docid} = $docid if defined($docid);
                        }
                        @$vivify_xvmd = sort { $a <=> $b } keys(%docids);
                }