diff options
author | Eric Wong <e@80x24.org> | 2019-05-14 02:04:43 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2019-05-14 02:05:59 +0000 |
commit | 1b7e935ab1690e28d790d8db5af2714f13c258cc (patch) | |
tree | f3c0808f0f5855fb1b3b78d219c5c7cf666e9908 /lib/PublicInbox/OverIdx.pm | |
parent | 20759636853f59b1d59cd979e72375422de29059 (diff) | |
download | public-inbox-1b7e935ab1690e28d790d8db5af2714f13c258cc.tar.gz |
We were reindexing the full history every invocation of -index when Xapian was not used because we were incorrectly relying on 'last_commit' metadata stored in Xapian. Rewrite the indexing logic to be less confusing while we're at it, since we rely on `git merge-base --is-ancestor' nowadays. Furthermore, we need to handle message removals from the overview index correctly when Xapian is not in use. Co-authored-by: Eric W. Biederman <ebiederm@xmission.com>
Diffstat (limited to 'lib/PublicInbox/OverIdx.pm')
-rw-r--r-- | lib/PublicInbox/OverIdx.pm | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/PublicInbox/OverIdx.pm b/lib/PublicInbox/OverIdx.pm index cc9bd7d4..bb3068dd 100644 --- a/lib/PublicInbox/OverIdx.pm +++ b/lib/PublicInbox/OverIdx.pm @@ -317,14 +317,21 @@ sub delete_articles { $self->delete_by_num($_) foreach @$nums; } +# returns number of removed messages +# $oid may be undef to match only on $mid sub remove_oid { my ($self, $oid, $mid) = @_; + my $nr = 0; $self->begin_lazy; each_by_mid($self, $mid, ['ddd'], sub { my ($smsg) = @_; - $self->delete_by_num($smsg->{num}) if $smsg->{blob} eq $oid; + if (!defined($oid) || $smsg->{blob} eq $oid) { + $self->delete_by_num($smsg->{num}); + $nr++; + } 1; }); + $nr; } sub create_tables { |