about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-02-26 23:42:14 +0000
committerEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-02-28 23:06:20 +0000
commit5abd4b9a1013f5cf3859dbd6e02044757fb98489 (patch)
tree56d0126670dabb5f5ea90bab66588af47a58ded0 /lib
parente63db5a1a563fb18db53fe1b8349dc52f325bd8b (diff)
downloadpublic-inbox-5abd4b9a1013f5cf3859dbd6e02044757fb98489.tar.gz
A different Xapian DB requires the use of a different Enquire
object.  This is necessary for get_thread and thread skeleton
to work in the PSGI UI.
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/Search.pm13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm
index 3a27512b..0f102dac 100644
--- a/lib/PublicInbox/Search.pm
+++ b/lib/PublicInbox/Search.pm
@@ -207,7 +207,7 @@ sub get_thread {
         # always sort threads by timestamp, this makes life easier
         # for the threading algorithm (in SearchThread.pm)
         $opts->{asc} = 1;
-
+        $opts->{enquire} = enquire_skel($self);
         _do_enquire($self, $qtid, $opts);
 }
 
@@ -235,7 +235,7 @@ sub _do_enquire {
 
 sub _enquire_once {
         my ($self, $query, $opts) = @_;
-        my $enquire = $self->enquire;
+        my $enquire = $opts->{enquire} || enquire($self);
         if (defined $query) {
                 $query = Search::Xapian::Query->new(OP_AND,$query,$mail_query);
         } else {
@@ -423,6 +423,15 @@ sub enquire {
         $self->{enquire} ||= Search::Xapian::Enquire->new($self->{xdb});
 }
 
+sub enquire_skel {
+        my ($self) = @_;
+        if (my $skel = $self->{skel}) {
+                $self->{enquire_skel} ||= Search::Xapian::Enquire->new($skel);
+        } else {
+                enquire($self);
+        }
+}
+
 sub help {
         my ($self) = @_;
         $self->qp; # parse altids