]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/LeiSearch.pm
update copyrights for 2021
[public-inbox.git] / lib / PublicInbox / LeiSearch.pm
index 66c16e0485fd611f7dbad6186301bb920426d8b5..b7e337de38d7b870d1045ba417de28fedb1f010a 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2020 all contributors <meta@public-inbox.org>
+# Copyright (C) 2020-2021 all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 
 package PublicInbox::LeiSearch;
@@ -7,20 +7,18 @@ use v5.10.1;
 use parent qw(PublicInbox::ExtSearch);
 use PublicInbox::Search;
 
-sub combined_docid ($$) {
+# get combined docid from over.num:
+# (not generic Xapian, only works with our sharding scheme)
+sub num2docid ($$) {
        my ($self, $num) = @_;
-       ($num - 1) * $self->{nshard} + 1;
+       my $nshard = $self->{nshard};
+       ($num - 1) * $nshard + $num % $nshard + 1;
 }
 
 sub msg_keywords {
        my ($self, $num) = @_; # num_or_mitem
        my $xdb = $self->xdb; # set {nshard};
-       my $docid = ref($num) ? $num->get_docid : do {
-               # get combined docid from over.num:
-               # (not generic Xapian, only works with our sharding scheme)
-               my $nshard = $self->{nshard};
-               ($num - 1) * $nshard + $num % $nshard + 1;
-       };
+       my $docid = ref($num) ? $num->get_docid : num2docid($self, $num);
        my %kw;
        eval {
                my $end = $xdb->termlist_end($docid);