From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 8C8981FB0D for ; Fri, 4 Dec 2020 22:03:50 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 3/5] search: remove mdocid export Date: Fri, 4 Dec 2020 22:03:47 +0000 Message-Id: <20201204220349.4408-4-e@80x24.org> In-Reply-To: <20201204220349.4408-1-e@80x24.org> References: <20201204220349.4408-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: 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); }