unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 3/5] search: remove mdocid export
Date: Fri,  4 Dec 2020 22:03:47 +0000	[thread overview]
Message-ID: <20201204220349.4408-4-e@80x24.org> (raw)
In-Reply-To: <20201204220349.4408-1-e@80x24.org>

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);
 	}

  parent reply	other threads:[~2020-12-04 22:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-04 22:03 [PATCH 0/5] more ->ALL usage Eric Wong
2020-12-04 22:03 ` [PATCH 1/5] nntp: xref_by_tc: simplify slightly Eric Wong
2020-12-04 22:03 ` [PATCH 2/5] nntp: small speed up for multi-line responses Eric Wong
2020-12-04 22:03 ` Eric Wong [this message]
2020-12-04 22:03 ` [PATCH 4/5] newswww: use ->ALL to avoid O(n) inbox scan Eric Wong
2020-12-04 22:03 ` [PATCH 5/5] extmsg: use ->ALL for "global" MID lookups Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201204220349.4408-4-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).