* [PATCH 3/5] search: remove mdocid export
2020-12-04 22:03 6% [PATCH 0/5] more ->ALL usage Eric Wong
@ 2020-12-04 22:03 7% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2020-12-04 22:03 UTC (permalink / raw)
To: meta
There's no need to export it, as shown by the change to
SearchView. This should pave the way to making search
more flexible and allow per-Inbox search to reuse ->ALL.
---
lib/PublicInbox/Search.pm | 2 +-
lib/PublicInbox/SearchView.pm | 11 +++++------
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm
index 574bc145..7e72913f 100644
--- a/lib/PublicInbox/Search.pm
+++ b/lib/PublicInbox/Search.pm
@@ -6,7 +6,7 @@
package PublicInbox::Search;
use strict;
use parent qw(Exporter);
-our @EXPORT_OK = qw(mdocid retry_reopen);
+our @EXPORT_OK = qw(retry_reopen);
use List::Util qw(max);
# values for searching, changing the numeric value breaks
diff --git a/lib/PublicInbox/SearchView.pm b/lib/PublicInbox/SearchView.pm
index c482f1c9..26426c01 100644
--- a/lib/PublicInbox/SearchView.pm
+++ b/lib/PublicInbox/SearchView.pm
@@ -14,7 +14,7 @@ use PublicInbox::WwwAtomStream;
use PublicInbox::WwwStream qw(html_oneshot);
use PublicInbox::SearchThread;
use PublicInbox::SearchQuery;
-use PublicInbox::Search qw(mdocid);
+use PublicInbox::Search;
my %rmap_inc;
sub mbox_results {
@@ -287,13 +287,12 @@ sub get_pct ($) {
sub mset_thread {
my ($ctx, $mset, $q) = @_;
my $ibx = $ctx->{-inbox};
- my $nshard = $ibx->search->{nshard} // 1;
- my %pct = map { mdocid($nshard, $_) => get_pct($_) } $mset->items;
- my $msgs = $ibx->over->get_all(keys %pct);
- $_->{pct} = $pct{$_->{num}} for @$msgs;
+ my @pct = map { get_pct($_) } $mset->items;
+ my $msgs = $ibx->search->mset_to_smsg($ibx, $mset);
+ my $i = 0;
+ $_->{pct} = $pct[$i++] for @$msgs;
my $r = $q->{r};
if ($r) { # for descriptions in search_nav_bot
- my @pct = values %pct;
$q->{-min_pct} = min(@pct);
$q->{-max_pct} = max(@pct);
}
^ permalink raw reply related [relevance 7%]
* [PATCH 0/5] more ->ALL usage
@ 2020-12-04 22:03 6% Eric Wong
2020-12-04 22:03 7% ` [PATCH 3/5] search: remove mdocid export Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2020-12-04 22:03 UTC (permalink / raw)
To: meta
Some tiny speedups to NNTP, and more WWW bits start using ->ALL
to avoid iterating through hundreds/thousands of inboxes.
Still experimenting with reindexing bits (and it's still slow :<)
Eric Wong (5):
nntp: xref_by_tc: simplify slightly
nntp: small speed up for multi-line responses
search: remove mdocid export
newswww: use ->ALL to avoid O(n) inbox scan
extmsg: use ->ALL for "global" MID lookups
lib/PublicInbox/Config.pm | 4 ++--
lib/PublicInbox/ExtMsg.pm | 36 ++++++++++++++++++++++++++++++++---
lib/PublicInbox/NNTP.pm | 24 +++++++++++------------
lib/PublicInbox/NNTPD.pm | 9 +++++++--
lib/PublicInbox/NewsWWW.pm | 30 ++++++++++++++++++++++-------
lib/PublicInbox/Search.pm | 2 +-
lib/PublicInbox/SearchView.pm | 11 +++++------
7 files changed, 82 insertions(+), 34 deletions(-)
^ permalink raw reply [relevance 6%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2020-12-04 22:03 6% [PATCH 0/5] more ->ALL usage Eric Wong
2020-12-04 22:03 7% ` [PATCH 3/5] search: remove mdocid export Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
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).