]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/ExtSearchIdx.pm
v2writable: more accurate {current_info} warnings/progress
[public-inbox.git] / lib / PublicInbox / ExtSearchIdx.pm
index 9da425383ad6f2f2f7618d89326557e10d1d78b7..503428021854d827f5970a1c73510790d3c62976 100644 (file)
@@ -30,6 +30,7 @@ use File::Spec;
 
 sub new {
        my (undef, $dir, $opt) = @_;
+       $dir = File::Spec->canonpath($dir);
        my $l = $opt->{indexlevel} // 'full';
        $l !~ $PublicInbox::SearchIdx::INDEXLEVELS and
                die "invalid indexlevel=$l\n";
@@ -164,7 +165,8 @@ sub do_finalize ($) {
        } elsif (exists $req->{new_smsg}) { # totally unseen messsage
                index_unseen($req);
        } else {
-               warn "W: ignoring delete $req->{oid} (not found)\n";
+               # `d' message was already unindexed in the v1/v2 inboxes,
+               # so it's too noisy to warn, here.
        }
 }
 
@@ -248,17 +250,22 @@ sub cur_ibx_xnum ($$) {
 
 sub index_oid { # git->cat_async callback for 'm'
        my ($bref, $oid, $type, $size, $req) = @_;
+       my $self = $req->{self};
+       local $self->{current_info} = "$self->{current_info} $oid";
        return if is_bad_blob($oid, $type, $size, $req->{oid});
        my $new_smsg = $req->{new_smsg} = bless {
                blob => $oid,
        }, 'PublicInbox::Smsg';
        $new_smsg->{bytes} = $size + crlf_adjust($$bref);
        defined($req->{xnum} = cur_ibx_xnum($req, $bref)) or return;
+       ++${$req->{nr}};
        do_step($req);
 }
 
 sub unindex_oid { # git->cat_async callback for 'd'
        my ($bref, $oid, $type, $size, $req) = @_;
+       my $self = $req->{self};
+       local $self->{current_info} = "$self->{current_info} $oid";
        return if is_bad_blob($oid, $type, $size, $req->{oid});
        return if defined(cur_ibx_xnum($req, $bref)); # was re-added
        do_step($req);
@@ -284,6 +291,8 @@ sub _sync_inbox ($$$) {
                -opt => $opt,
                self => $self,
                ibx => $ibx,
+               nr => \(my $nr = 0),
+               -regen_fmt => "%u/?\n",
        };
        my $v = $ibx->version;
        my $ekey = $ibx->eidx_key;