From 592f8239dceb6604e538fd51e62bcce50d6e1972 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 17 Jul 2020 06:31:55 +0000 Subject: search: simplify unindexing Since over.sqlite3 seems here to stay, we no longer need to do Message-ID lookups against Xapian and can simply rely on the docid <=> NNTP article number equivalancy SCHEMA_VERSION=15 gave us. This rids us of the closure-using batch_do sub in the v1 code path and vastly simplifies both v1 and v2 unindexing. --- lib/PublicInbox/OverIdx.pm | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'lib/PublicInbox/OverIdx.pm') diff --git a/lib/PublicInbox/OverIdx.pm b/lib/PublicInbox/OverIdx.pm index 29c6e0b9..5601e602 100644 --- a/lib/PublicInbox/OverIdx.pm +++ b/lib/PublicInbox/OverIdx.pm @@ -326,22 +326,23 @@ INSERT INTO id2num (id, num) VALUES (?,?) } sub _remove_oid { - my ($self, $smsg, $oid, $nr) = @_; + my ($self, $smsg, $oid, $removed) = @_; if (!defined($oid) || $smsg->{blob} eq $oid) { delete_by_num($self, $smsg->{num}); - $$nr++; + push @$removed, $smsg->{num}; } 1; } -# returns number of removed messages +# returns number of removed messages in scalar context, +# array of removed article numbers in array context. # $oid may be undef to match only on $mid sub remove_oid { my ($self, $oid, $mid) = @_; - my $nr = 0; + my $removed = []; begin_lazy($self); - each_by_mid($self, $mid, ['ddd'], \&_remove_oid, $oid, \$nr); - $nr; + each_by_mid($self, $mid, ['ddd'], \&_remove_oid, $oid, $removed); + @$removed; } sub _num_mid0_for_oid { -- cgit v1.2.3-24-ge0c7