diff options
author | Eric Wong <e@80x24.org> | 2021-09-21 07:41:59 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-09-21 19:18:36 +0000 |
commit | c1cfe2c2ff17bca3cafb9dea4d7a7697eeab9683 (patch) | |
tree | dcad22ec6df905ca6f19f00744b33fa1356e8946 /lib/PublicInbox/LeiUp.pm | |
parent | 21fd0da3bcfba4d3564d262f88d3fd7479b6d5ee (diff) | |
download | public-inbox-c1cfe2c2ff17bca3cafb9dea4d7a7697eeab9683.tar.gz |
Avoid slurping gigantic (e.g. 100000) result sets into a single response if a giant limit is specified, and instead use 10000 as a window for the mset with a given offset. We'll also warn and hint towards about the --limit= switch when the estimated result set is larger than the default limit.
Diffstat (limited to 'lib/PublicInbox/LeiUp.pm')
-rw-r--r-- | lib/PublicInbox/LeiUp.pm | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/lib/PublicInbox/LeiUp.pm b/lib/PublicInbox/LeiUp.pm index abb05d46..89cf0112 100644 --- a/lib/PublicInbox/LeiUp.pm +++ b/lib/PublicInbox/LeiUp.pm @@ -18,7 +18,6 @@ sub up1 ($$) { my $lss = PublicInbox::LeiSavedSearch->up($lei, $out) or return; my $f = $lss->{'-f'}; my $mset_opt = $lei->{mset_opt} = { relevance => -2 }; - $mset_opt->{limit} = $lei->{opt}->{limit} // 10000; my $q = $mset_opt->{q_raw} = $lss->{-cfg}->{'lei.q'} // return $lei->fail("lei.q unset in $f"); my $lse = $lei->{lse} // die 'BUG: {lse} missing'; @@ -27,24 +26,18 @@ sub up1 ($$) { } else { $lse->query_approxidate($lse->git, $mset_opt->{qstr} = $q); } - my $o = $lei->{opt}->{output} = $lss->{-cfg}->{'lei.q.output'} // - return $lei->fail("lei.q.output unset in $f"); - ref($o) and return $lei->fail("multiple values of lei.q.output in $f"); - if (defined(my $dd = $lss->{-cfg}->{'lei.q.dedupe'})) { - $lss->translate_dedupe($lei, $dd) or return; - $lei->{opt}->{dedupe} = $dd; - } - for my $k (qw(only include exclude)) { + # n.b. only a few CLI args are accepted for "up", so //= usually sets + for my $k ($lss->ARRAY_FIELDS) { my $v = $lss->{-cfg}->get_all("lei.q.$k") // next; - $lei->{opt}->{$k} = $v; + $lei->{opt}->{$k} //= $v; } - for my $k (qw(external local remote - import-remote import-before threads)) { - my $c = "lei.q.$k"; - my $v = $lss->{-cfg}->{$c} // next; - ref($v) and return $lei->fail("multiple values of $c in $f"); - $lei->{opt}->{$k} = $v; + for my $k ($lss->BOOL_FIELDS, $lss->SINGLE_FIELDS) { + my $v = $lss->{-cfg}->get_1('lei.q', $k) // next; + $lei->{opt}->{$k} //= $v; } + my $o = $lei->{opt}->{output} // ''; + return $lei->fail("lei.q.output unset in $f") if $o eq ''; + $lss->translate_dedupe($lei) or return; $lei->{lss} = $lss; # for LeiOverview->new and query_remote_mboxrd my $lxs = $lei->lxs_prepare or return; $lei->ale->refresh_externals($lxs, $lei); |