]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Search.pm
search: avoid setting undef hashtable entries
[public-inbox.git] / lib / PublicInbox / Search.pm
index d285c11cf07058051202c7bda48a6cb7f66a7b87..17e202e1da8300c5e7927ca4322f2c49bf4a5cb8 100644 (file)
@@ -234,12 +234,12 @@ sub mset_to_artnums {
 
 sub xdb ($) {
        my ($self) = @_;
-       $self->{xdb} //= do {
+       $self->{xdb} // do {
                my @xdb = $self->xdb_shards_flat or return;
                $self->{nshard} = scalar(@xdb);
                my $xdb = shift @xdb;
                $xdb->add_database($_) for @xdb;
-               $xdb;
+               $self->{xdb} = $xdb;
        };
 }
 
@@ -261,10 +261,10 @@ sub new {
        my ($class, $ibx) = @_;
        ref $ibx or die "BUG: expected PublicInbox::Inbox object: $ibx";
        my $xap = $ibx->version > 1 ? 'xap' : 'public-inbox/xapian';
-       bless {
-               xpfx => "$ibx->{inboxdir}/$xap" . SCHEMA_VERSION,
-               altid => $ibx->{altid},
-       }, $class;
+       my $xpfx = "$ibx->{inboxdir}/$xap".SCHEMA_VERSION;
+       my $self = bless { xpfx => $xpfx }, $class;
+       $self->{altid} = $ibx->{altid} if defined($ibx->{altid});
+       $self;
 }
 
 sub reopen {