1 # Copyright (C) 2020 all contributors <meta@public-inbox.org>
2 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
4 package PublicInbox::LeiSearch;
7 use parent qw(PublicInbox::ExtSearch);
8 use PublicInbox::Search;
10 sub combined_docid ($$) {
11 my ($self, $num) = @_;
12 ($num - 1) * $self->{nshard} + 1;
16 my ($self, $num) = @_; # num_or_mitem
17 my $xdb = $self->xdb; # set {nshard};
18 my $docid = ref($num) ? $num->get_docid : do {
19 # get combined docid from over.num:
20 # (not generic Xapian, only works with our sharding scheme)
21 my $nshard = $self->{nshard};
22 ($num - 1) * $nshard + $num % $nshard + 1;
26 my $end = $xdb->termlist_end($docid);
27 my $cur = $xdb->termlist_begin($docid);
28 for (; $cur != $end; $cur++) {
31 my $kw = $cur->get_termname;
32 $kw =~ s/\AK//s and $kw{$kw} = undef;
35 warn "E: #$docid ($num): $@\n" if $@;
36 wantarray ? sort(keys(%kw)) : \%kw;