]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Search.pm
search: require PublicInbox::Inbox ref here
[public-inbox.git] / lib / PublicInbox / Search.pm
index 9903f427013bebeee9bbd1f427965a8c6cd84ede..098c97cdc2c11c72893d07a4eb4ffa3bb14bc856 100644 (file)
@@ -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");