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)
$ENQ_ASCENDING = $x eq 'Xapian' ?
1 : Search::Xapian::ENQ_ASCENDING();
- # for Smsg:
- *PublicInbox::Smsg::sortable_unserialise =
- $Xap.'::sortable_unserialise';
# n.b. FLAG_PURE_NOT is expensive not suitable for a public
# website as it could become a denial-of-service vector
# FLAG_PHRASE also seems to cause performance problems chert
# 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);