]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
extindex: avoid branch in ->index_eml
authorEric Wong <e@80x24.org>
Sat, 10 Aug 2024 09:00:08 +0000 (09:00 +0000)
committerEric Wong <e@80x24.org>
Sat, 17 Aug 2024 17:36:17 +0000 (17:36 +0000)
We'll probably be stuffing more extindex-specific fields in
here, so it simplifies our internal API.

lib/PublicInbox/ExtSearchIdx.pm
lib/PublicInbox/SearchIdxShard.pm

index 934197c05bab9e1f5972a490f06c8efa3d4493e9..68700c8b8e932f8d610c381c65103734e7b2fcb8 100644 (file)
@@ -245,7 +245,8 @@ sub index_unseen ($) {
        my $oid = $new_smsg->{blob};
        my $ibx = delete $req->{ibx} or die 'BUG: {ibx} unset';
        $self->{oidx}->add_xref3($docid, $req->{xnum}, $oid, $ibx->eidx_key);
-       $idx->index_eml($eml, $new_smsg, $ibx->eidx_key);
+       $new_smsg->{eidx_key} = $ibx->eidx_key;
+       $idx->index_eml($eml, $new_smsg);
        check_batch_limit($req);
 }
 
@@ -578,7 +579,8 @@ sub _reindex_finalize ($$$) {
        my $top_smsg = pop @$stable;
        $top_smsg == $smsg or die 'BUG: top_smsg != smsg';
        my $ibx = _ibx_for($self, $sync, $smsg);
-       $idx->index_eml($eml, $smsg, $ibx->eidx_key);
+       $smsg->{eidx_key} = $ibx->eidx_key;
+       $idx->index_eml($eml, $smsg);
        for my $x (reverse @$stable) {
                $ibx = _ibx_for($self, $sync, $x);
                my $hdr = delete $x->{hdr} // die 'BUG: no {hdr}';
index ea261bdab7298408e50735a8ffe2fa3da61122e9..7ee8a1214f3126b840cbfa402ea23daac4b8a1e9 100644 (file)
@@ -49,8 +49,7 @@ sub ipc_atfork_child { # called automatically before ipc_worker_loop
 }
 
 sub index_eml {
-       my ($self, $eml, $smsg, $eidx_key) = @_;
-       $smsg->{eidx_key} = $eidx_key if defined $eidx_key;
+       my ($self, $eml, $smsg) = @_;
        $self->ipc_do('add_xapian', $eml, $smsg);
 }