]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/SearchView.pm
search: remove mdocid export
[public-inbox.git] / lib / PublicInbox / SearchView.pm
index 892e8fdae14038098bc9cd9ae21f5dcd97b2a1fc..26426c0114687f91e031cbf8bb1790765de42863 100644 (file)
@@ -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 {
@@ -47,7 +47,6 @@ sub sres_top_html {
        my $opts = {
                limit => $q->{l},
                offset => $o,
-               mset => 1,
                relevance => $q->{r},
                thread => $q->{t},
                asc => $asc,
@@ -55,7 +54,7 @@ sub sres_top_html {
        my ($mset, $total, $err, $html);
 retry:
        eval {
-               $mset = $srch->query($query, $opts);
+               $mset = $srch->mset($query, $opts);
                $total = $mset->get_matches_estimated;
        };
        $err = $@;
@@ -288,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);
        }