]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Search.pm
rename reference to git epochs as "partitions"
[public-inbox.git] / lib / PublicInbox / Search.pm
index c054a87497c400f3a2b2053b94f828eff78400d0..098c97cdc2c11c72893d07a4eb4ffa3bb14bc856 100644 (file)
@@ -144,7 +144,7 @@ sub _xdb ($) {
        my $qpf = \($self->{qp_flags} ||= $QP_FLAGS);
        if ($self->{version} >= 2) {
                foreach my $part (<$dir/*>) {
-                       -d $part && $part =~ m!/\d+\z! or next;
+                       -d $part && $part =~ m!/[0-9]+\z! or next;
                        my $sub = Search::Xapian::Database->new($part);
                        if ($xdb) {
                                $xdb->add_database($sub);
@@ -170,17 +170,12 @@ sub xdb ($) {
 }
 
 sub new {
-       my ($class, $mainrepo, $altid) = @_;
-       my $version = 1;
-       my $ibx = $mainrepo;
-       if (ref $ibx) {
-               $version = $ibx->{version} || 1;
-               $mainrepo = $ibx->{mainrepo};
-       }
+       my ($class, $ibx) = @_;
+       ref $ibx or die "BUG: expected PublicInbox::Inbox object: $ibx";
        my $self = bless {
-               mainrepo => $mainrepo,
-               altid => $altid,
-               version => $version,
+               mainrepo => $ibx->{mainrepo},
+               altid => $ibx->{altid},
+               version => $ibx->{version} // 1,
        }, $class;
        my $dir = xdir($self, 1);
        $self->{over_ro} = PublicInbox::Over->new("$dir/over.sqlite3");