From ba135f3e25bf5d1b3aa3d34e31fefb55ee4c8d29 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 17 Dec 2020 03:39:49 +0000 Subject: 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. --- lib/PublicInbox/V2Writable.pm | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'lib/PublicInbox/V2Writable.pm') diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm index e8a5fbd2..7d41b0f6 100644 --- a/lib/PublicInbox/V2Writable.pm +++ b/lib/PublicInbox/V2Writable.pm @@ -73,13 +73,7 @@ sub count_shards ($) { delete $ibx->{search}; $srch->{nshard} // 0 } else { # ExtSearchIdx - $self->{nshard} // do { - if ($self->xdb_sharded) { - $self->{nshard} // die 'BUG: {nshard} unset'; - } else { - 0; - } - } + $self->{nshard} ||= scalar($self->xdb_shards_flat); } } -- cgit v1.2.3-24-ge0c7