From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id E95ED1FAF1 for ; Wed, 28 Feb 2018 23:42:08 +0000 (UTC) From: "Eric Wong (Contractor, The Linux Foundation)" To: meta@public-inbox.org Subject: [PATCH 15/21] search: use different Enquire object for skeleton queries Date: Wed, 28 Feb 2018 23:41:56 +0000 Message-Id: <20180228234202.8839-16-e@80x24.org> In-Reply-To: <20180228234202.8839-1-e@80x24.org> References: <20180228234202.8839-1-e@80x24.org> List-Id: 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. --- lib/PublicInbox/Search.pm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm index 3a27512..0f102da 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 -- EW