diff options
author | Eric Wong <e@80x24.org> | 2021-10-14 03:12:25 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-10-14 09:07:14 +0000 |
commit | c8b441f4ddcb9f6cbbe54cd380fe89586d023124 (patch) | |
tree | 2d63566131a6a465841ca330d24f4c05507304cf /lib/PublicInbox/Search.pm | |
parent | c485036d0b1ce7ed94ea02f84a8a5cd86144ad02 (diff) | |
download | public-inbox-c8b441f4ddcb9f6cbbe54cd380fe89586d023124.tar.gz |
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.
Diffstat (limited to 'lib/PublicInbox/Search.pm')
-rw-r--r-- | lib/PublicInbox/Search.pm | 8 |
1 files changed, 8 insertions, 0 deletions
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; |