X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FMiscIdx.pm;h=64591d0516ddcfef135ee77c697f61b85012f583;hb=0d38f65c490466837ae091afa7a7b6f59d04ce7c;hp=acb49ce79acf041f43f76f050a07572d634e6c1b;hpb=2c012a3a2f95d9cf268bd92a61a53fc1633ba8f3;p=public-inbox.git diff --git a/lib/PublicInbox/MiscIdx.pm b/lib/PublicInbox/MiscIdx.pm index acb49ce7..64591d05 100644 --- a/lib/PublicInbox/MiscIdx.pm +++ b/lib/PublicInbox/MiscIdx.pm @@ -53,6 +53,22 @@ sub commit_txn { delete($self->{xdb})->commit_transaction; } +sub remove_eidx_key { + my ($self, $eidx_key) = @_; + my $xdb = $self->{xdb}; + my $head = $xdb->postlist_begin('Q'.$eidx_key); + my $tail = $xdb->postlist_end('Q'.$eidx_key); + my @docids; # only one, unless we had bugs + for (; $head != $tail; $head++) { + push @docids, $head->get_docid; + } + for my $docid (@docids) { + $xdb->delete_document($docid); + warn "I: remove inbox docid #$docid ($eidx_key)\n"; + } +} + +# adds or updates according to $eidx_key sub index_ibx { my ($self, $ibx) = @_; my $eidx_key = $ibx->eidx_key; @@ -106,10 +122,12 @@ EOF my $git = $ibx->git_epoch($epoch) or return; if (my $ent = $git->manifest_entry($epoch, $desc)) { $data->{"$pfx$epoch.git"} = $ent; + $ent->{git_dir} = $git->{git_dir}; } $git->cleanup; # ->modified starts cat-file --batch } } elsif (my $ent = $ibx->git->manifest_entry) { # v1 + $ent->{git_dir} = $ibx->{inboxdir}; $data->{"/$ibx->{name}"} = $ent; } $doc->set_data(PublicInbox::Config::json()->encode($data));