about summary refs log tree commit homepage
path: root/lib/PublicInbox
diff options
context:
space:
mode:
Diffstat (limited to 'lib/PublicInbox')
-rw-r--r--lib/PublicInbox/XapHelper.pm4
-rw-r--r--lib/PublicInbox/xap_helper.h1
2 files changed, 4 insertions, 1 deletions
diff --git a/lib/PublicInbox/XapHelper.pm b/lib/PublicInbox/XapHelper.pm
index 099bc4fe..c9957f64 100644
--- a/lib/PublicInbox/XapHelper.pm
+++ b/lib/PublicInbox/XapHelper.pm
@@ -191,8 +191,9 @@ sub dispatch {
                 or return;
         my $dirs = delete $req->{d} or die 'no -d args';
         my $key = join("\0", @$dirs);
+        my $new;
         $req->{srch} = $SRCH{$key} //= do {
-                my $new = { qp_flags => $PublicInbox::Search::QP_FLAGS };
+                $new = { qp_flags => $PublicInbox::Search::QP_FLAGS };
                 my $first = shift @$dirs;
                 my $slow_phrase = -f "$first/iamchert";
                 $new->{xdb} = $X->{Database}->new($first);
@@ -207,6 +208,7 @@ sub dispatch {
                 $new->{qp} = $new->qparse_new;
                 $new;
         };
+        $req->{srch}->{xdb}->reopen unless $new;
         $req->{Q} && !$req->{srch}->{qp_extra_done} and
                 srch_init_extra $req;
         my $timeo = $req->{K};
diff --git a/lib/PublicInbox/xap_helper.h b/lib/PublicInbox/xap_helper.h
index bdc1c5b1..a30a8768 100644
--- a/lib/PublicInbox/xap_helper.h
+++ b/lib/PublicInbox/xap_helper.h
@@ -712,6 +712,7 @@ static void dispatch(struct req *req)
         req->srch = *s;
         if (req->srch != kbuf.srch) { // reuse existing
                 free_srch(kbuf.srch);
+                req->srch->db->reopen();
         } else if (!srch_init(req)) {
                 assert(kbuf.srch == *((struct srch **)tfind(
                                         kbuf.srch, &srch_tree, srch_cmp)));