use PublicInbox::IdxStack;
use Carp qw(croak);
use POSIX qw(strftime);
+use Time::Local qw(timegm);
use PublicInbox::OverIdx;
use PublicInbox::Spawn qw(spawn nodatacow_dir);
use PublicInbox::Git qw(git_unquote);
}
eval 'require '.$X->{WritableDatabase} or die;
*sortable_serialise = $xap.'::sortable_serialise';
+ *sortable_unserialise = $xap.'::sortable_unserialise';
$DB_CREATE_OR_OPEN = eval($xap.'::DB_CREATE_OR_OPEN()');
$DB_OPEN = eval($xap.'::DB_OPEN()');
my $ver = (eval($xap.'::major_version()') << 16) |
$doc->add_boolean_term('Q' . $_) for @$mids;
for my $l ($hdr->header_raw('List-Id')) {
$l =~ /<([^>]+)>/ or next;
- my $lid = $1;
+ my $lid = lc $1;
$doc->add_boolean_term('G' . $lid);
index_text($self, $lid, 1, 'XL'); # probabilistic
}
$smsg->{num};
}
+sub get_val ($$) {
+ my ($doc, $col) = @_;
+ sortable_unserialise($doc->get_value($col));
+}
+
+sub smsg_from_doc ($) {
+ my ($doc) = @_;
+ my $data = $doc->get_data or return;
+ my $smsg = bless {}, 'PublicInbox::Smsg';
+ $smsg->{ts} = get_val($doc, PublicInbox::Search::TS());
+ my $dt = get_val($doc, PublicInbox::Search::DT());
+ my ($yyyy, $mon, $dd, $hh, $mm, $ss) = unpack('A4A2A2A2A2A2', $dt);
+ $smsg->{ds} = timegm($ss, $mm, $hh, $dd, $mon - 1, $yyyy);
+ $smsg->load_from_data($data);
+ $smsg;
+}
+
sub xdb_remove {
my ($self, $oid, @removed) = @_;
my $xdb = $self->{xdb} or return;
warn "E: #$num $oid missing in Xapian\n";
next;
}
- my $smsg = bless {}, 'PublicInbox::Smsg';
- $smsg->load_expand($doc);
- my $blob = $smsg->{blob} // '(unset)';
- if ($blob eq $oid) {
+ my $smsg = smsg_from_doc($doc);
+ my $blob = $smsg->{blob}; # may be undef if --skip-docdata
+ if (!defined($blob) || $blob eq $oid) {
$xdb->delete_document($num);
} else {
warn "E: #$num $oid != $blob in Xapian\n";
sub v1_checkpoint ($$;$) {
my ($self, $sync, $stk) = @_;
- $self->{ibx}->git->check_async_wait;
- $self->{ibx}->git->cat_async_wait;
+ $self->{ibx}->git->async_wait_all;
# latest_cmt may be undef
my $newest = $stk ? $stk->{latest_cmt} : undef;