about summary refs log tree commit homepage
path: root/lib/PublicInbox/LeiSearch.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2020-12-17 03:39:49 +0000
committerEric Wong <e@80x24.org>2020-12-19 09:32:08 +0000
commitba135f3e25bf5d1b3aa3d34e31fefb55ee4c8d29 (patch)
tree591c59df84844c8383c103f3b23b0dc9394e763e /lib/PublicInbox/LeiSearch.pm
parent475e6b6a722361223505a7fcb084f5e729c69240 (diff)
downloadpublic-inbox-ba135f3e25bf5d1b3aa3d34e31fefb55ee4c8d29.tar.gz
search: simplify initialization, add ->xdb_shards_flat
This reduces differences between v1 and v2 code, and
introduces ->xdb_shards_flat to provide read-only access
to shards without using Xapian::MultiDatabase.  This
will allow us to combine shards of several inboxes
AND extindexes for lei.
Diffstat (limited to 'lib/PublicInbox/LeiSearch.pm')
-rw-r--r--lib/PublicInbox/LeiSearch.pm5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/PublicInbox/LeiSearch.pm b/lib/PublicInbox/LeiSearch.pm
index 9cfd6ea2..66c16e04 100644
--- a/lib/PublicInbox/LeiSearch.pm
+++ b/lib/PublicInbox/LeiSearch.pm
@@ -9,8 +9,7 @@ use PublicInbox::Search;
 
 sub combined_docid ($$) {
         my ($self, $num) = @_;
-        my $nshard = ($self->{nshard} // 1);
-        ($num - 1) * $nshard  + 1;
+        ($num - 1) * $self->{nshard} + 1;
 }
 
 sub msg_keywords {
@@ -19,7 +18,7 @@ sub msg_keywords {
         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} // 1;
+                my $nshard = $self->{nshard};
                 ($num - 1) * $nshard + $num % $nshard + 1;
         };
         my %kw;