* [PATCH] mbox: hoist out refill_result_ids
@ 2024-04-22 9:58 Eric Wong
0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2024-04-22 9:58 UTC (permalink / raw)
To: spew
---
lib/PublicInbox/Mbox.pm | 32 ++++++++++++++------------------
1 file changed, 14 insertions(+), 18 deletions(-)
diff --git a/lib/PublicInbox/Mbox.pm b/lib/PublicInbox/Mbox.pm
index 4a0f4681..e58fb4b6 100644
--- a/lib/PublicInbox/Mbox.pm
+++ b/lib/PublicInbox/Mbox.pm
@@ -175,6 +175,17 @@ sub mbox_all_ids {
PublicInbox::MboxGz::mbox_gz($ctx, \&all_ids_cb, 'all');
}
+sub refill_result_ids ($) {
+ my ($ctx) = @_;
+ # refill result set, deprioritize since there's many results
+ my $srch = $ctx->{ibx}->isrch or return $ctx->gone('search');
+ my $mset = $srch->mset($ctx->{query}, $ctx->{qopts});
+ my $size = $mset->size or return;
+ $ctx->{qopts}->{offset} += $size;
+ $ctx->{ids} = $srch->mset_to_artnums($mset, $ctx->{qopts});
+ $ctx->{-low_prio} = 1; # true
+}
+
sub results_cb {
my ($ctx) = @_;
my $over = $ctx->{ibx}->over or return $ctx->gone('over');
@@ -183,13 +194,7 @@ sub results_cb {
my $smsg = $over->get_art($num) or next;
return $smsg;
}
- # refill result set, deprioritize since there's many results
- my $srch = $ctx->{ibx}->isrch or return $ctx->gone('search');
- my $mset = $srch->mset($ctx->{query}, $ctx->{qopts});
- my $size = $mset->size or return;
- $ctx->{qopts}->{offset} += $size;
- $ctx->{ids} = $srch->mset_to_artnums($mset, $ctx->{qopts});
- $ctx->{-low_prio} = 1;
+ refill_result_ids($ctx) or return; # refill ctx->{ids}
}
}
@@ -202,19 +207,10 @@ sub results_thread_cb {
my $smsg = $over->get_art($num) or next;
return $smsg;
}
+ next if $over->expand_thread($ctx); # refills ctx->{xids}
- # refills ctx->{xids}
- next if $over->expand_thread($ctx);
-
- # refill result set, deprioritize since there's many results
- my $srch = $ctx->{ibx}->isrch or return $ctx->gone('search');
- my $mset = $srch->mset($ctx->{query}, $ctx->{qopts});
- my $size = $mset->size or return;
- $ctx->{qopts}->{offset} += $size;
- $ctx->{ids} = $srch->mset_to_artnums($mset, $ctx->{qopts});
- $ctx->{-low_prio} = 1;
+ refill_result_ids($ctx) or return; # refill ctx->{ids}
}
-
}
sub mbox_qry_cb { # async_mset cb
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2024-04-22 9:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-22 9:58 [PATCH] mbox: hoist out refill_result_ids Eric Wong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).