From 525555d14118f92f86be54c683f797089c52a78d Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 5 Dec 2020 10:11:38 +0000 Subject: isearch: emulate per-inbox search with ->ALL Using "eidx_key:" boolean prefix to limit results to a given inbox, we can use ->ALL to emulate and replace per-Inbox xap15/[0-9] search indices. With this change, the presence of "extindex.all.topdir" in the $PI_CONFIG will cause the WWW code to use that extindex and ignore per-inbox Xapian DBs in xap15/[0-9]. Unfortunately IMAP search still requires old per-inbox indices, for now. Mapping extindex Xapian docids to per-Inbox UIDs and vice-versa is proving tricky. Fortunately, IMAP search is rarely used and optional. The RFCs don't specify expensive phrase search, either, so `indexlevel=medium' can be used in per-inbox Xapian indices to save space. For primarily WWW (and future JMAP) users; this should result in significant disk space, FD, and page cache footprint savings for large instances with many inboxes and many cross-posted messages. --- lib/PublicInbox/Mbox.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/PublicInbox/Mbox.pm') diff --git a/lib/PublicInbox/Mbox.pm b/lib/PublicInbox/Mbox.pm index 22516998..19459150 100644 --- a/lib/PublicInbox/Mbox.pm +++ b/lib/PublicInbox/Mbox.pm @@ -218,7 +218,7 @@ sub results_cb { return $smsg; } # refill result set - my $srch = $ctx->{-inbox}->search or return gone($ctx,'search'); + my $srch = $ctx->{-inbox}->isrch or return gone($ctx, 'search'); my $mset = $srch->mset($ctx->{query}, $ctx->{qopts}); my $size = $mset->size or return; $ctx->{qopts}->{offset} += $size; @@ -240,7 +240,7 @@ sub results_thread_cb { next if $over->expand_thread($ctx); # refill result set - my $srch = $ctx->{-inbox}->search or return gone($ctx,'search'); + my $srch = $ctx->{-inbox}->isrch or return gone($ctx, 'search'); my $mset = $srch->mset($ctx->{query}, $ctx->{qopts}); my $size = $mset->size or return; $ctx->{qopts}->{offset} += $size; @@ -253,7 +253,7 @@ sub mbox_all { my ($ctx, $q) = @_; my $q_string = $q->{'q'}; return mbox_all_ids($ctx) if $q_string !~ /\S/; - my $srch = $ctx->{-inbox}->search or + my $srch = $ctx->{-inbox}->isrch or return PublicInbox::WWW::need($ctx, 'Search'); my $over = $ctx->{-inbox}->over or return PublicInbox::WWW::need($ctx, 'Overview'); -- cgit v1.2.3-24-ge0c7