about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2020-12-27 11:01:41 +0000
committerEric Wong <e@80x24.org>2020-12-28 23:18:48 +0000
commitd209c2064ebc8ccddc7f0da068c663fc08077334 (patch)
tree22f61072fa9b1e5ae01fb3bfb42a4ffbfadc8868
parente411f4465dd26d8b09d005224a8ead7056e6e532 (diff)
downloadpublic-inbox-d209c2064ebc8ccddc7f0da068c663fc08077334.tar.gz
Since ExtSearch lacks the janky cleanup timer of
PublicInbox::Inbox objects, its search results get stale.

Reopen the Xapian DB on every ->search call for now, as
reducing reopen calls doesn't seem worth the complexity.

The Xapian::Database::reopen operation itself takes only ~50us
on my old workstation with 3 shards totaling <200GB.  Other
parts of Xapian dominates the search time, so the reopen seems
inconsequential with single-digit shard counts.
-rw-r--r--lib/PublicInbox/ExtSearch.pm4
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/PublicInbox/ExtSearch.pm b/lib/PublicInbox/ExtSearch.pm
index a2b97798..7c9586a6 100644
--- a/lib/PublicInbox/ExtSearch.pm
+++ b/lib/PublicInbox/ExtSearch.pm
@@ -29,8 +29,6 @@ sub misc {
         $self->{misc} //= PublicInbox::MiscSearch->new("$self->{xpfx}/misc");
 }
 
-sub search { $_[0] } # self
-
 # overrides PublicInbox::Search::_xdb
 sub _xdb {
         my ($self) = @_;
@@ -126,6 +124,6 @@ no warnings 'once';
 *recent = \&PublicInbox::Inbox::recent;
 
 *max_git_epoch = *nntp_usable = *msg_by_path = \&mm; # undef
-*isrch = *search;
+*isrch = *search = \&PublicInbox::Search::reopen;
 
 1;