use strict;
use parent qw(Exporter);
our @EXPORT_OK = qw(mdocid);
+use List::Util qw(max);
# values for searching, changing the numeric value breaks
# compatibility with old indices (so don't change them it)
# We need numeric sorting so shard[0] is first for reading
# Xapian metadata, if needed
- for (sort { $a <=> $b } grep(/\A[0-9]+\z/, readdir($dh))) {
+ my $last = max(grep(/\A[0-9]+\z/, readdir($dh)));
+ return if !defined($last);
+ for (0..$last) {
my $shard_dir = "$dir/$_";
if (-d $shard_dir && -r _) {
push @xdb, $X{Database}->new($shard_dir);
ibx_ver => $ibx->version,
}, $class;
xpfx_init($self);
- my $dir = xdir($self, 1);
- $self->{over_ro} = PublicInbox::Over->new("$dir/over.sqlite3");
$self;
}