X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FLeiALE.pm;h=45748435b53407995a66f337359b6833ba40eb6b;hb=0b3d4d72297f82cb43993074dfc4650a01f75683;hp=bdb50a1a08a2b34b16531d5f9e1ca96f9ab1f404;hpb=bd287d742b81dab13e936727724e5c4de55c44c7;p=public-inbox.git diff --git a/lib/PublicInbox/LeiALE.pm b/lib/PublicInbox/LeiALE.pm index bdb50a1a..45748435 100644 --- a/lib/PublicInbox/LeiALE.pm +++ b/lib/PublicInbox/LeiALE.pm @@ -11,16 +11,29 @@ use v5.10.1; use parent qw(PublicInbox::LeiSearch PublicInbox::Lock); use PublicInbox::Git; use PublicInbox::Import; +use PublicInbox::LeiXSearch; use Fcntl qw(SEEK_SET); -sub new { - my ($cls, $d) = @_; +sub _new { + my ($d) = @_; PublicInbox::Import::init_bare($d, 'ale'); bless { git => PublicInbox::Git->new($d), lock_path => "$d/lei_ale.state", # dual-duty lock + state ibxish => [], # Inbox and ExtSearch (and LeiSearch) objects - }, $cls; + }, __PACKAGE__ +} + +sub new { + my ($self, $lei) = @_; + ref($self) or $self = _new($lei->cache_dir . '/all_locals_ever.git'); + my $lxs = PublicInbox::LeiXSearch->new; + $lxs->prepare_external($lei->_lei_store(1)->search); + for my $loc ($lei->externals_each) { # locals only + $lxs->prepare_external($loc) if -d $loc; + } + $self->refresh_externals($lxs); + $self; } sub over {} # undef for xoids_for