sub detect_indexlevel ($) {
my ($ibx) = @_;
- # brand new or never before indexed inboxes default to full
- return 'full' unless $ibx->over;
- delete $ibx->{over}; # don't leave open FD lying around
+ my $over = $ibx->over;
+ my $srch = $ibx->search;
+ delete @$ibx{qw(over search)}; # don't leave open FDs lying around
+ # brand new or never before indexed inboxes default to full
+ return 'full' unless $over;
my $l = 'basic';
- my $srch = $ibx->search or return $l;
- delete $ibx->{search}; # don't leave open FD lying around
+ return $l unless $srch;
if (my $xdb = $srch->xdb) {
$l = 'full';
my $m = $xdb->get_metadata('indexlevel');
$ibx->{inboxdir} has unexpected indexlevel in Xapian: $m
}
+ $ibx->{-skip_docdata} = 1 if $xdb->get_metadata('skip_docdata');
}
$l;
}
my $min_ver = $opt->{-min_inbox_version} || 0;
my (@old, @ibxs);
my %dir2ibx;
+ my $all = $opt->{all} ? [] : undef;
if ($cfg) {
$cfg->each_inbox(sub {
my ($ibx) = @_;
my $path = abs_path($ibx->{inboxdir});
if (defined($path)) {
$dir2ibx{$path} = $ibx;
+ push @$all, $ibx if $all;
} else {
warn <<EOF;
W: $ibx->{name} $ibx->{inboxdir}: $!
}
});
}
- if ($opt->{all}) {
- my @all = values %dir2ibx;
- @all = grep { $_->version >= $min_ver } @all;
- push @ibxs, @all;
+ if ($all) {
+ @$all = grep { $_->version >= $min_ver } @$all;
+ @ibxs = @$all;
} else { # directories specified on the command-line
my $i = 0;
my @dirs = @$argv;
}
}
if (@old) {
- die "inboxes $min_ver inboxes not supported by $0\n\t",
+ die "-V$min_ver inboxes not supported by $0\n\t",
join("\n\t", @old), "\n";
}
@ibxs;