diff options
author | Eric Wong <e@80x24.org> | 2021-03-20 19:04:07 +0900 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-03-21 09:45:50 +0000 |
commit | 0b3d4d72297f82cb43993074dfc4650a01f75683 (patch) | |
tree | 1e63ab9604b7c9ac71e5b5866e763d946a988895 /lib/PublicInbox/LeiALE.pm | |
parent | bd287d742b81dab13e936727724e5c4de55c44c7 (diff) | |
download | public-inbox-0b3d4d72297f82cb43993074dfc4650a01f75683.tar.gz |
This should make a future change to "lei import" work more nicely, since we'll be needing ALE to vivify external-only messages upon explicit "lei import".
Diffstat (limited to 'lib/PublicInbox/LeiALE.pm')
-rw-r--r-- | lib/PublicInbox/LeiALE.pm | 19 |
1 files changed, 16 insertions, 3 deletions
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 |