From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 843711F463; Mon, 23 Dec 2019 18:07:12 +0000 (UTC) Date: Mon, 23 Dec 2019 18:07:12 +0000 From: Eric Wong To: meta@public-inbox.org Subject: Re: [PATCH 3/4] search: support SWIG-generated Xapian.pm Message-ID: <20191223180712.GA20619@dcvr> References: <20191222221740.17114-1-e@80x24.org> <20191222221740.17114-4-e@80x24.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20191222221740.17114-4-e@80x24.org> List-Id: Eric Wong wrote: > More information about the status of the "Xapian" Perl module here: > https://trac.xapian.org/ticket/523 > diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm > index 88c8dc70..7d83419d 100644 > --- a/lib/PublicInbox/Search.pm > +++ b/lib/PublicInbox/Search.pm > @@ -17,20 +17,42 @@ use PublicInbox::MIME; > use PublicInbox::MID qw/id_compress/; > use PublicInbox::Over; > my $QP_FLAGS; > +our %X = map { $_ => 0 } qw(BoolWeight Database Enquire > + NumberValueRangeProcessor QueryParser Stem); > +our $Xap; # 'Search::Xapian' or 'Xapian' > +my $ENQ_ASCENDING; > + > sub load_xapian () { > - $QP_FLAGS ||= eval { > - require Search::Xapian; > - Search::Xapian->import(qw(:standard)); > + return 1 if defined $Xap; > + for my $x (qw(Xapian Search::Xapian)) { > + eval "require $x"; > + next if $@; Given the current status of "Xapian" not being in Debian (where the Xapian package maintainer is also upstream), perhaps the order should be swapped in case there's other misbehaviors not uncovered by our test suite: diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm index 7d83419d..65c6ee83 100644 --- a/lib/PublicInbox/Search.pm +++ b/lib/PublicInbox/Search.pm @@ -24,7 +24,7 @@ my $ENQ_ASCENDING; sub load_xapian () { return 1 if defined $Xap; - for my $x (qw(Xapian Search::Xapian)) { + for my $x (qw(Search::Xapian Xapian)) { eval "require $x"; next if $@;