]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Mbox.pm
move ->ids_after from mm to over
[public-inbox.git] / lib / PublicInbox / Mbox.pm
index 83fa7d8a2ffb4acabca3e3405743aceb51982889..f72af26baeadc9602bbccbd75a6e2395bcf7bdae 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2020 all contributors <meta@public-inbox.org>
+# Copyright (C) 2015-2021 all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 
 # Streaming interface for mboxrd HTTP responses
@@ -161,19 +161,17 @@ sub all_ids_cb {
                        my $smsg = $ctx->{over}->get_art($num) or next;
                        return $smsg;
                }
-               $ctx->{ids} = $ids = $ctx->{mm}->ids_after(\($ctx->{prev}));
+               $ctx->{ids} = $ids = $ctx->{over}->ids_after(\($ctx->{prev}));
        } while (@$ids);
 }
 
 sub mbox_all_ids {
        my ($ctx) = @_;
-       my $ibx = $ctx->{ibx};
        my $prev = 0;
-       my $mm = $ctx->{mm} = $ibx->mm;
-       my $ids = $mm->ids_after(\$prev) or return
-               [404, [qw(Content-Type text/plain)], ["No results found\n"]];
-       $ctx->{over} = $ibx->over or
+       $ctx->{over} = $ctx->{ibx}->over or
                return PublicInbox::WWW::need($ctx, 'Overview');
+       my $ids = $ctx->{over}->ids_after(\$prev) or return
+               [404, [qw(Content-Type text/plain)], ["No results found\n"]];
        $ctx->{ids} = $ids;
        $ctx->{prev} = $prev;
        require PublicInbox::MboxGz;
@@ -235,8 +233,9 @@ sub mbox_all {
        my $over = $ctx->{ibx}->over or
                return PublicInbox::WWW::need($ctx, 'Overview');
 
-       my $qopts = $ctx->{qopts} = { relevance => -1 }; # ORDER BY docid ASC
-       $qopts->{thread} = 1 if $q->{t};
+       my $qopts = $ctx->{qopts} = { relevance => -2 }; # ORDER BY docid DESC
+       $qopts->{threads} = 1 if $q->{t};
+       $srch->query_approxidate($ctx->{ibx}->git, $q_string);
        my $mset = $srch->mset($q_string, $qopts);
        $qopts->{offset} = $mset->size or
                        return [404, [qw(Content-Type text/plain)],