diff options
author | Eric Wong <e@80x24.org> | 2023-09-11 07:26:39 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-09-11 18:51:02 +0000 |
commit | 22c5b815cc4105228fd34cdaa2826dca70552a3e (patch) | |
tree | fb5fc859c7c18729d817a1664921db7b40917558 /lib | |
parent | bdf6cb8ca93a6aec7065b4ba8f3f4b1f58f427b4 (diff) | |
download | public-inbox-22c5b815cc4105228fd34cdaa2826dca70552a3e.tar.gz |
The Xapian SWIG bindings are favored by Xapian upstream for ease-of-maintenance compared to the XS version. While Debian lags on this front, the SWIG bindings are widely available on all *BSDs.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/PublicInbox/Admin.pm | 8 | ||||
-rw-r--r-- | lib/PublicInbox/AdminEdit.pm | 4 | ||||
-rw-r--r-- | lib/PublicInbox/Feed.pm | 2 | ||||
-rw-r--r-- | lib/PublicInbox/Search.pm | 11 | ||||
-rw-r--r-- | lib/PublicInbox/TestCommon.pm | 4 |
5 files changed, 13 insertions, 16 deletions
diff --git a/lib/PublicInbox/Admin.pm b/lib/PublicInbox/Admin.pm index 72ac9420..3140afad 100644 --- a/lib/PublicInbox/Admin.pm +++ b/lib/PublicInbox/Admin.pm @@ -185,13 +185,13 @@ my @over_mod = qw(DBD::SQLite DBI); my %mod_groups = ( -index => [ @base_mod, @over_mod ], -base => \@base_mod, - -search => [ @base_mod, @over_mod, 'Search::Xapian' ], + -search => [ @base_mod, @over_mod, 'Xapian' ], ); sub scan_ibx_modules ($$) { my ($mods, $ibx) = @_; if (!$ibx->{indexlevel} || $ibx->{indexlevel} ne 'basic') { - $mods->{'Search::Xapian'} = 1; + $mods->{'Xapian'} = 1; } else { $mods->{$_} = 1 foreach @over_mod; } @@ -203,10 +203,10 @@ sub check_require { while (my $mod = shift @mods) { if (my $groups = $mod_groups{$mod}) { push @mods, @$groups; - } elsif ($mod eq 'Search::Xapian') { + } elsif ($mod eq 'Xapian') { require PublicInbox::Search; PublicInbox::Search::load_xapian() or - $err->{'Search::Xapian || Xapian'} = $@; + $err->{'Xapian || Search::Xapian'} = $@; } else { eval "require $mod"; $err->{$mod} = $@ if $@; diff --git a/lib/PublicInbox/AdminEdit.pm b/lib/PublicInbox/AdminEdit.pm index c8c3d3e8..654141a7 100644 --- a/lib/PublicInbox/AdminEdit.pm +++ b/lib/PublicInbox/AdminEdit.pm @@ -19,11 +19,11 @@ sub check_editable ($) { } # Undefined indexlevel, so `full'... - # Search::Xapian exists and the DB can be read, at least, fine + # Xapian exists and the DB can be read, at least, fine $ibx->search and next; # it's possible for a Xapian directory to exist, - # but Search::Xapian to go missing/broken. + # but Xapian to go missing/broken. # Make sure it's purged in that case: $ibx->over or die "no over.sqlite3 in $ibx->{inboxdir}\n"; diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm index 69a92f8b..225565f4 100644 --- a/lib/PublicInbox/Feed.pm +++ b/lib/PublicInbox/Feed.pm @@ -7,7 +7,7 @@ use strict; use v5.10.1; use PublicInbox::View; use PublicInbox::WwwAtomStream; -use PublicInbox::Smsg; # this loads w/o Search::Xapian +use PublicInbox::Smsg; # this loads w/o Xapian sub generate_i { my ($ctx) = @_; diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm index 2e784646..d7a6f9d7 100644 --- a/lib/PublicInbox/Search.pm +++ b/lib/PublicInbox/Search.pm @@ -59,7 +59,7 @@ use PublicInbox::Smsg; use PublicInbox::Over; our $QP_FLAGS; our %X = map { $_ => 0 } qw(BoolWeight Database Enquire QueryParser Stem Query); -our $Xap; # 'Search::Xapian' or 'Xapian' +our $Xap; # 'Xapian' or 'Search::Xapian' our $NVRP; # '$Xap::'.('NumberValueRangeProcessor' or 'NumberRangeProcessor') # ENQ_DESCENDING and ENQ_ASCENDING weren't in SWIG Xapian.pm prior to 1.4.16, @@ -78,10 +78,8 @@ our @MAIL_NRP; sub load_xapian () { return 1 if defined $Xap; - # n.b. PI_XAPIAN is intended for development use only. We still - # favor Search::Xapian since that's what's available in current - # Debian stable (10.x) and derived distros. - for my $x (($ENV{PI_XAPIAN} // 'Search::Xapian'), 'Xapian') { + # n.b. PI_XAPIAN is intended for development use only + for my $x (($ENV{PI_XAPIAN} // 'Xapian'), 'Search::Xapian') { eval "require $x"; next if $@; @@ -94,8 +92,7 @@ sub load_xapian () { # NumberRangeProcessor was added in Xapian 1.3.6, # NumberValueRangeProcessor was removed for 1.5.0+, - # favor the older /Value/ variant since that's what our - # (currently) preferred Search::Xapian supports + # continue with the older /Value/ variant for now... $NVRP = $x.'::'.($x eq 'Xapian' && $xver ge v1.5 ? 'NumberRangeProcessor' : 'NumberValueRangeProcessor'); $X{$_} = $Xap.'::'.$_ for (keys %X); diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm index b2774f58..ec300b3f 100644 --- a/lib/PublicInbox/TestCommon.pm +++ b/lib/PublicInbox/TestCommon.pm @@ -134,7 +134,7 @@ sub require_mods { while (my $mod = shift(@mods)) { if ($mod eq 'lei') { require_git(2.6, $maybe ? $maybe : ()); - push @mods, qw(DBD::SQLite Search::Xapian +SCM_RIGHTS); + push @mods, qw(DBD::SQLite Xapian +SCM_RIGHTS); $mod = 'json'; # fall-through } if ($mod eq 'json') { @@ -150,7 +150,7 @@ sub require_mods { push @mods, qw(DBD::SQLite); next; } - if ($mod eq 'Search::Xapian') { + if ($mod eq 'Xapian') { if (eval { require PublicInbox::Search } && PublicInbox::Search::load_xapian()) { next; |