From c8b441f4ddcb9f6cbbe54cd380fe89586d023124 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 14 Oct 2021 03:12:25 +0000 Subject: lei inspect: account for non-extindex inboxes Inbox->xdb does not exist, but this code path was apparently never tested :x I noticed this on basic v2 inbox, but it could happen with any v1/v2 inbox. Move ->num2docid into Search so it's less awkward to use. --- lib/PublicInbox/Search.pm | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/PublicInbox/Search.pm') diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm index f0e7ed0c..d89bf545 100644 --- a/lib/PublicInbox/Search.pm +++ b/lib/PublicInbox/Search.pm @@ -570,4 +570,12 @@ sub xap_terms ($$;@) { wantarray ? sort(keys(%ret)) : \%ret; } +# get combined docid from over.num: +# (not generic Xapian, only works with our sharding scheme) +sub num2docid ($$) { + my ($self, $num) = @_; + my $nshard = $self->{nshard}; + ($num - 1) * $nshard + $num % $nshard + 1; +} + 1; -- cgit v1.2.3-24-ge0c7