diff options
author | Eric Wong <e@yhbt.net> | 2020-08-01 08:12:26 +0000 |
---|---|---|
committer | Eric Wong <e@yhbt.net> | 2020-08-02 08:26:19 +0000 |
commit | fb4bfa102bfa702f13948ac689e54bac9d0084e0 (patch) | |
tree | 941b96a3d89df231232adf4ceec65a739ed890b4 /lib/PublicInbox/SearchIdx.pm | |
parent | 84e006fdb9fb72010d6a0dac15287ff43bd1772c (diff) | |
download | public-inbox-fb4bfa102bfa702f13948ac689e54bac9d0084e0.tar.gz |
We can rely on the newer mids() sub directly and use faster numeric comparisons for Msgmap unindexing in v1.
Diffstat (limited to 'lib/PublicInbox/SearchIdx.pm')
-rw-r--r-- | lib/PublicInbox/SearchIdx.pm | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm index 080aca7c..feb00de2 100644 --- a/lib/PublicInbox/SearchIdx.pm +++ b/lib/PublicInbox/SearchIdx.pm @@ -12,7 +12,7 @@ use v5.10.1; use parent qw(PublicInbox::Search PublicInbox::Lock Exporter); use PublicInbox::Eml; use PublicInbox::InboxWritable; -use PublicInbox::MID qw(mid_mime mids_for_index mids); +use PublicInbox::MID qw(mids_for_index mids); use PublicInbox::MsgIter; use PublicInbox::IdxStack; use Carp qw(croak); @@ -492,6 +492,11 @@ sub unindex_eml { while (my ($num, $nr) = each %tmp) { warn "BUG: $num appears >1 times ($nr) for $oid\n" if $nr != 1; } + if ($nr) { + $self->{mm}->num_delete($_) for (keys %tmp); + } else { # just in case msgmap and over.sqlite3 become desynched: + $self->{mm}->mid_delete($mids->[0]); + } xdb_remove($self, $oid, keys %tmp) if need_xapian($self); } @@ -512,11 +517,6 @@ sub index_mm { } } -sub unindex_mm { - my ($self, $mime) = @_; - $self->{mm}->mid_delete(mid_mime($mime)); -} - # returns the number of bytes to add if given a non-CRLF arg sub crlf_adjust ($) { if (index($_[0], "\r\n") < 0) { @@ -544,9 +544,7 @@ sub index_both { # git->cat_async callback sub unindex_both { # git->cat_async callback my ($bref, $oid, $type, $size, $self) = @_; - my $eml = PublicInbox::Eml->new($bref); - unindex_eml($self, $oid, $eml); - unindex_mm($self, $eml); + unindex_eml($self, $oid, PublicInbox::Eml->new($bref)); } # called by public-inbox-index |