It's a needless wrapper, nowadays.  Originally, ->over was added
on experimental basis to optimize for /$INBOX/ where Xapian
->search is slower on gigantic (LKML-sized) inboxes.

Nowadays with extindex, ->over is here to stay given NNTP and
IMAP both benefit from it.  So reduce the interpreter stack
overhead and just access ->over directly.

lxs->recent was never used outside of tests, anyways.

And while we're in the area, avoid needlessly bumping the
refcount of $ctx->{ibx} in View::paginate_recent.
---
 lib/PublicInbox/ExtSearch.pm      |  1 -
 lib/PublicInbox/Inbox.pm          |  5 -----
 lib/PublicInbox/LeiSavedSearch.pm |  1 -
 lib/PublicInbox/LeiXSearch.pm     |  7 -------
 lib/PublicInbox/View.pm           |  5 ++---
 t/convert-compact.t               |  2 +-
 t/indexlevels-mirror.t            | 10 +++++-----
 t/lei_xsearch.t                   |  2 +-
 t/replace.t                       |  4 ++--
 t/v1-add-remove-add.t             |  2 +-
 t/v2-add-remove-add.t             |  2 +-
 11 files changed, 13 insertions(+), 28 deletions(-)

diff --git a/lib/PublicInbox/ExtSearch.pm b/lib/PublicInbox/ExtSearch.pm
index 3eb864a2..a69c0e76 100644
--- a/lib/PublicInbox/ExtSearch.pm
+++ b/lib/PublicInbox/ExtSearch.pm
@@ -125,7 +125,6 @@ no warnings 'once';
 *smsg_by_mid = \&PublicInbox::Inbox::smsg_by_mid;
 *msg_by_mid = \&PublicInbox::Inbox::msg_by_mid;
 *modified = \&PublicInbox::Inbox::modified;
-*recent = \&PublicInbox::Inbox::recent;
 
 *max_git_epoch = *nntp_usable = *msg_by_path = \&mm; # undef
 *isrch = \&search;
diff --git a/lib/PublicInbox/Inbox.pm b/lib/PublicInbox/Inbox.pm
index acd7f338..8ac7eb30 100644
--- a/lib/PublicInbox/Inbox.pm
+++ b/lib/PublicInbox/Inbox.pm
@@ -351,11 +351,6 @@ sub msg_by_mid ($$) {
        $smsg ? msg_by_smsg($self, $smsg) : msg_by_path($self, mid2path($mid));
 }
 
-sub recent {
-       my ($self, $opts, $after, $before) = @_;
-       $self->over->recent($opts, $after, $before);
-}
-
 sub modified {
        my ($self) = @_;
        if (my $over = $self->over) {
diff --git a/lib/PublicInbox/LeiSavedSearch.pm 
b/lib/PublicInbox/LeiSavedSearch.pm
index 1d13aef6..ed92bfd1 100644
--- a/lib/PublicInbox/LeiSavedSearch.pm
+++ b/lib/PublicInbox/LeiSavedSearch.pm
@@ -299,7 +299,6 @@ no warnings 'once';
 *smsg_by_mid = \&PublicInbox::Inbox::smsg_by_mid;
 *msg_by_mid = \&PublicInbox::Inbox::msg_by_mid;
 *modified = \&PublicInbox::Inbox::modified;
-*recent = \&PublicInbox::Inbox::recent;
 *max_git_epoch = *nntp_usable = *msg_by_path = \&mm; # undef
 *isrch = *search = \&mm; # TODO
 *DESTROY = \&pause_dedupe;
diff --git a/lib/PublicInbox/LeiXSearch.pm b/lib/PublicInbox/LeiXSearch.pm
index 6f877019..90cb83b9 100644
--- a/lib/PublicInbox/LeiXSearch.pm
+++ b/lib/PublicInbox/LeiXSearch.pm
@@ -103,13 +103,6 @@ sub smsg_for {
        $smsg;
 }
 
-sub recent {
-       my ($self, $qstr, $opt) = @_;
-       $opt //= {};
-       $opt->{relevance} //= -2;
-       $self->mset($qstr //= 'z:1..', $opt);
-}
-
 sub over {}
 
 sub _check_mset_limit ($$$) {
diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index 9846fa47..466ec6cf 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -1237,12 +1237,11 @@ sub paginate_recent ($$) {
        $t =~ s/\A([0-9]{8,14})-// and $after = str2ts($1);
        $t =~ /\A([0-9]{8,14})\z/ and $before = str2ts($1);
 
-       my $ibx = $ctx->{ibx};
-       my $msgs = $ibx->recent($opts, $after, $before);
+       my $msgs = $ctx->{ibx}->over->recent($opts, $after, $before);
        my $nr = scalar @$msgs;
        if ($nr < $lim && defined($after)) {
                $after = $before = undef;
-               $msgs = $ibx->recent($opts);
+               $msgs = $ctx->{ibx}->over->recent($opts);
                $nr = scalar @$msgs;
        }
        my $more = $nr == $lim;
diff --git a/t/convert-compact.t b/t/convert-compact.t
index 7270cab0..def09567 100644
--- a/t/convert-compact.t
+++ b/t/convert-compact.t
@@ -101,7 +101,7 @@ foreach (@xdir) {
        is($st[2] & 07777, -f _ ? 0444 : 0755,
                'sharedRepository respected after v2 compact');
 }
-my $msgs = $ibx->recent({limit => 1000});
+my $msgs = $ibx->over->recent({limit => 1000});
 is($msgs->[0]->{mid}, 'a-mid@b', 'message exists in history');
 is(scalar @$msgs, 1, 'only one message in history');
 
diff --git a/t/indexlevels-mirror.t b/t/indexlevels-mirror.t
index ac85643d..463b35be 100644
--- a/t/indexlevels-mirror.t
+++ b/t/indexlevels-mirror.t
@@ -41,7 +41,7 @@ my $import_index_incremental = sub {
                inboxdir => $ibx->{inboxdir},
                indexlevel => $level
        });
-       my $msgs = $ro_master->recent;
+       my $msgs = $ro_master->over->recent;
        is(scalar(@$msgs), 1, 'only one message in master, so far');
        is($msgs->[0]->{mid}, 'm@1', 'first message in master indexed');
 
@@ -71,7 +71,7 @@ my $import_index_incremental = sub {
                inboxdir => $mirror,
                indexlevel => $level,
        });
-       $msgs = $ro_mirror->recent;
+       $msgs = $ro_mirror->over->recent;
        is(scalar(@$msgs), 1, 'only one message, so far');
        is($msgs->[0]->{mid}, 'm@1', 'read first message');
 
@@ -83,7 +83,7 @@ my $import_index_incremental = sub {
        # mirror updates
        is(xsys('git', "--git-dir=$fetch_dir", qw(fetch -q)), 0, 'fetch OK');
        ok(run_script([qw(-index -j0), $mirror]), "v$v index mirror again OK");
-       $msgs = $ro_mirror->recent;
+       $msgs = $ro_mirror->over->recent;
        is(scalar(@$msgs), 2, '2nd message seen in mirror');
        is_deeply([sort { $a cmp $b } map { $_->{mid} } @$msgs],
                ['m@1','m@2'], 'got both messages in mirror');
@@ -91,7 +91,7 @@ my $import_index_incremental = sub {
        # incremental index master (required for v1)
        ok(run_script([qw(-index -j0), $ibx->{inboxdir}, "-L$level"]),
                'index master OK');
-       $msgs = $ro_master->recent;
+       $msgs = $ro_master->over->recent;
        is(scalar(@$msgs), 2, '2nd message seen in master');
        is_deeply([sort { $a cmp $b } map { $_->{mid} } @$msgs],
                ['m@1','m@2'], 'got both messages in master');
@@ -120,7 +120,7 @@ my $import_index_incremental = sub {
        # sync the mirror
        is(xsys('git', "--git-dir=$fetch_dir", qw(fetch -q)), 0, 'fetch OK');
        ok(run_script([qw(-index -j0), $mirror]), "v$v index mirror again OK");
-       $msgs = $ro_mirror->recent;
+       $msgs = $ro_mirror->over->recent;
        is(scalar(@$msgs), 1, '2nd message gone from mirror');
        is_deeply([map { $_->{mid} } @$msgs], ['m@1'],
                'message unavailable in mirror');
diff --git a/t/lei_xsearch.t b/t/lei_xsearch.t
index d9ddb297..fabceb41 100644
--- a/t/lei_xsearch.t
+++ b/t/lei_xsearch.t
@@ -61,7 +61,7 @@ for my $mi ($mset->items) {
 }
 is(scalar(@msgs), $nr, 'smsgs retrieved for all');
 
-$mset = $lxs->recent(undef, { limit => 1 });
+$mset = $lxs->mset('z:1..', { relevance => -2, limit => 1 });
 is($mset->size, 1, 'one result');
 
 my @ibxish = $lxs->locals;
diff --git a/t/replace.t b/t/replace.t
index 626cbe9b..0e121399 100644
--- a/t/replace.t
+++ b/t/replace.t
@@ -49,7 +49,7 @@ EOF
        $im->done;
        my $thread_a = $ibx->over->get_thread('[email protected]');
 
-       my %before = map {; delete($_->{blob}) => $_ } @{$ibx->recent};
+       my %before = map {; delete($_->{blob}) => $_ } @{$ibx->over->recent};
        my $reject = PublicInbox::Eml->new($orig->as_string);
        foreach my $mid (['<[email protected]>', '<[email protected]>'],
                                [], ['<[email protected]>']) {
@@ -126,7 +126,7 @@ EOF
        }
 
        # check overview matches:
-       my %after = map {; delete($_->{blob}) => $_ } @{$ibx->recent};
+       my %after = map {; delete($_->{blob}) => $_ } @{$ibx->over->recent};
        my @before_blobs = keys %before;
        foreach my $blob (@before_blobs) {
                delete $before{$blob} if delete $after{$blob};
diff --git a/t/v1-add-remove-add.t b/t/v1-add-remove-add.t
index a94bf7fd..ae045dfa 100644
--- a/t/v1-add-remove-add.t
+++ b/t/v1-add-remove-add.t
@@ -32,7 +32,7 @@ ok($im->add($mime), 'message added again');
 $im->done;
 my $rw = PublicInbox::SearchIdx->new($ibx, 1);
 $rw->index_sync;
-my $msgs = $ibx->recent({limit => 10});
+my $msgs = $ibx->over->recent({limit => 10});
 is($msgs->[0]->{mid}, 'a-mid@b', 'message exists in history');
 is(scalar @$msgs, 1, 'only one message in history');
 is($ibx->mm->num_for('a-mid@b'), 2, 'exists with second article number');
diff --git a/t/v2-add-remove-add.t b/t/v2-add-remove-add.t
index 579cdcb6..6affc830 100644
--- a/t/v2-add-remove-add.t
+++ b/t/v2-add-remove-add.t
@@ -32,7 +32,7 @@ ok($im->add($mime), 'message added');
 ok($im->remove($mime), 'message removed');
 ok($im->add($mime), 'message added again');
 $im->done;
-my $msgs = $ibx->recent({limit => 1000});
+my $msgs = $ibx->over->recent({limit => 1000});
 is($msgs->[0]->{mid}, 'a-mid@b', 'message exists in history');
 is(scalar @$msgs, 1, 'only one message in history');
 

Reply via email to