X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FLeiQuery.pm;h=007e35fc41cf061b4ce963afc0ba99e0fda37d94;hb=7d2e572aca7297ea2015d2b6e7c71b672521ec82;hp=623b92cdb78c3893de9c9cfcc7475261a5a160e0;hpb=7d186c6fa885c7b04c9e2a65b3fc501120b7866f;p=public-inbox.git diff --git a/lib/PublicInbox/LeiQuery.pm b/lib/PublicInbox/LeiQuery.pm index 623b92cd..007e35fc 100644 --- a/lib/PublicInbox/LeiQuery.pm +++ b/lib/PublicInbox/LeiQuery.pm @@ -57,6 +57,10 @@ sub lei_q { } if ($opt->{'local'} //= scalar(@only) ? 0 : 1) { $lxs->prepare_external($lse); + } else { + my $tmp = PublicInbox::LeiXSearch->new; + $tmp->prepare_external($lse); + $self->ale->refresh_externals($tmp); } if (@only) { for my $loc (@only) { @@ -64,9 +68,12 @@ sub lei_q { $lxs->prepare_external($_) for @loc; } } else { + my (@ilocals, @iremotes); for my $loc (@{$opt->{include} // []}) { my @loc = $self->get_externals($loc) or return; $lxs->prepare_external($_) for @loc; + @ilocals = @{$lxs->{locals} // []}; + @iremotes = @{$lxs->{remotes} // []}; } # --external is enabled by default, but allow --no-external if ($opt->{external} //= 1) { @@ -78,15 +85,16 @@ sub lei_q { my $ne = $self->externals_each(\&prep_ext, $lxs, \%x); $opt->{remote} //= !($lxs->locals - $opt->{'local'}); if ($opt->{'local'}) { - delete($lxs->{remotes}) if !$opt->{remote}; + $lxs->{remotes} = \@iremotes if !$opt->{remote}; } else { - delete($lxs->{locals}); + $lxs->{locals} = \@ilocals; } } } unless ($lxs->locals || $lxs->remotes) { return $self->fail('no local or remote inboxes to search'); } + $self->ale->refresh_externals($lxs); my ($xj, $mj) = split(/,/, $opt->{jobs} // ''); if (defined($xj) && $xj ne '' && $xj !~ /\A[1-9][0-9]*\z/) { return $self->fail("`$xj' search jobs must be >= 1");