]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/LeiStore.pm
lei: refine help/option parsing, implement "init"
[public-inbox.git] / lib / PublicInbox / LeiStore.pm
index 56f668b8cc768015420ea5aa82f59346312f7c1b..b5b49efbb7e7329dbd9f64e3840ed743e163a676 100644 (file)
@@ -22,7 +22,12 @@ use PublicInbox::LeiSearch;
 sub new {
        my (undef, $dir, $opt) = @_;
        my $eidx = PublicInbox::ExtSearchIdx->new($dir, $opt);
-       bless { priv_eidx => $eidx }, __PACKAGE__;
+       my $self = bless { priv_eidx => $eidx }, __PACKAGE__;
+       if ($opt->{creat}) {
+               PublicInbox::SearchIdx::load_xapian_writable();
+               eidx_init($self);
+       }
+       $self;
 }
 
 sub git { $_[0]->{priv_eidx}->git } # read-only