diff options
author | Eric Wong <e@80x24.org> | 2020-12-27 20:02:51 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2020-12-31 13:20:54 +0000 |
commit | 08de05443804120a2663aa3611c47c84a18e0c35 (patch) | |
tree | abfd80cfba197d6a38b0cfa52c17ca3adaf22ed9 /lib/PublicInbox/LeiSearch.pm | |
parent | 12583f45f29f3acd6cd704df9a7e5aaff5acc3f7 (diff) | |
download | public-inbox-08de05443804120a2663aa3611c47c84a18e0c35.tar.gz |
While a single extindex combines multiple inboxes into a single search index, extindex still requires up-front indexing on items which can be searched. XSearch has no on-disk footprint itself and uses Xapian DBs of existing publicinbox and extindex ("extinbox") exclusively. XSearch still suffers from the multi-shard Xapian scalability problems which led to the creation of extindex, but I expect the number of shards to remain relatively low. I envision users hosting public-inbox instances on their workstations will only have two extindex combined by this, one read-only extindex for serving public archives, and one read-write extindex managed by LeiStore for private mail.
Diffstat (limited to 'lib/PublicInbox/LeiSearch.pm')
-rw-r--r-- | lib/PublicInbox/LeiSearch.pm | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/PublicInbox/LeiSearch.pm b/lib/PublicInbox/LeiSearch.pm index 66c16e04..0b962b11 100644 --- a/lib/PublicInbox/LeiSearch.pm +++ b/lib/PublicInbox/LeiSearch.pm @@ -7,20 +7,18 @@ use v5.10.1; use parent qw(PublicInbox::ExtSearch); use PublicInbox::Search; -sub combined_docid ($$) { +# get combined docid from over.num: +# (not generic Xapian, only works with our sharding scheme) +sub num2docid ($$) { my ($self, $num) = @_; - ($num - 1) * $self->{nshard} + 1; + my $nshard = $self->{nshard}; + ($num - 1) * $nshard + $num % $nshard + 1; } sub msg_keywords { my ($self, $num) = @_; # num_or_mitem my $xdb = $self->xdb; # set {nshard}; - 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}; - ($num - 1) * $nshard + $num % $nshard + 1; - }; + my $docid = ref($num) ? $num->get_docid : num2docid($self, $num); my %kw; eval { my $end = $xdb->termlist_end($docid); |