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_raw(undef, $eml, $new_smsg, $ibx->eidx_key);
+ $idx->index_eml($eml, $new_smsg, $ibx->eidx_key);
check_batch_limit($req);
}
my $top_smsg = pop @$stable;
$top_smsg == $smsg or die 'BUG: top_smsg != smsg';
my $ibx = _ibx_for($self, $sync, $smsg);
- $idx->index_raw(undef, $eml, $smsg, $ibx->eidx_key);
+ $idx->index_eml($eml, $smsg, $ibx->eidx_key);
for my $x (reverse @$stable) {
$ibx = _ibx_for($self, $sync, $x);
my $hdr = delete $x->{hdr} // die 'BUG: no {hdr}';
$im->add($eml, undef, $smsg) or return; # duplicate returns undef
my $msgref = delete $smsg->{-raw_email};
$smsg->{bytes} = $smsg->{raw_bytes} + crlf_adjust($$msgref);
+ undef $msgref;
local $self->{current_info} = $smsg->{blob};
if (my @docids = _docids_for($self, $eml)) {
$oidx->add_overview($eml, $smsg);
$oidx->add_xref3($smsg->{num}, -1, $smsg->{blob}, '.');
my $idx = $eidx->idx_shard($smsg->{num});
- $idx->index_raw($msgref, $eml, $smsg);
+ $idx->index_eml($eml, $smsg);
$idx->ipc_do('add_keywords', $smsg->{num}, @kw) if @kw;
$smsg;
}
PublicInbox::OnDestroy->new($$, \&_worker_done, $self);
}
-sub index_raw {
- my ($self, $msgref, $eml, $smsg, $eidx_key) = @_;
- if ($eml) {
- undef($$msgref) if $msgref;
- } else { # --xapian-only + --sequential-shard:
- $eml = PublicInbox::Eml->new($msgref);
- }
+sub index_eml {
+ my ($self, $eml, $smsg, $eidx_key) = @_;
$smsg->{eidx_key} = $eidx_key if defined $eidx_key;
$self->ipc_do('add_message', $eml, $smsg);
}
# indexes a message, returns true if checkpointing is needed
sub do_idx ($$$$) {
- my ($self, $msgref, $mime, $smsg) = @_;
+ my ($self, $msgref, $eml, $smsg) = @_;
$smsg->{bytes} = $smsg->{raw_bytes} + crlf_adjust($$msgref);
- $self->{oidx}->add_overview($mime, $smsg);
+ $self->{oidx}->add_overview($eml, $smsg);
my $idx = idx_shard($self, $smsg->{num});
- $idx->index_raw($msgref, $mime, $smsg);
+ $idx->index_eml($eml, $smsg);
my $n = $self->{transact_bytes} += $smsg->{raw_bytes};
$n >= $self->{batch_bytes};
}
$cmt = $im->get_mark($cmt);
$self->{last_commit}->[$self->{epoch_max}] = $cmt;
- my $msgref = delete $smsg->{-raw_email};
- if (do_idx($self, $msgref, $mime, $smsg)) {
+ if (do_idx($self, delete $smsg->{-raw_email}, $mime, $smsg)) {
$self->checkpoint;
}
my $self = $smsg->{self};
my $idx = idx_shard($self, $smsg->{num});
$smsg->{raw_bytes} = $size;
- $idx->index_raw($bref, undef, $smsg);
+ $idx->index_eml(PublicInbox::Eml->new($bref), $smsg);
$self->{transact_bytes} += $size;
}