]> Sergey Matveev's repositories - public-inbox.git/commitdiff
Merge remote-tracking branch 'origin/xap-optional' into master
authorEric Wong <e@80x24.org>
Tue, 21 May 2019 23:22:05 +0000 (23:22 +0000)
committerEric Wong <e@80x24.org>
Tue, 21 May 2019 23:22:05 +0000 (23:22 +0000)
* origin/xap-optional:
  admin: improve warnings and errors for missing modules
  searchidx: do not create empty Xapian partitions for basic
  lazy load Xapian and make it optional for v2
  www: use Inbox->over where appropriate
  nntp: use Inbox->over directly
  inbox: add ->over method to ease access

1  2 
INSTALL
lib/PublicInbox/Inbox.pm
lib/PublicInbox/Search.pm
lib/PublicInbox/SearchIdx.pm
lib/PublicInbox/WWW.pm

diff --cc INSTALL
Simple merge
index 0b118b28cea84418f18a73cd5f6a63cfbbe0dae9,813ed997f1781ccc3791257f751124fdf5ee9021..0d86771fbd33677f08e652bcbbe9cfa87852d144
@@@ -23,14 -25,8 +23,14 @@@ sub cleanup_task () 
        my $next = {};
        for my $ibx (values %$CLEANUP) {
                my $again;
 -              foreach my $f (qw(mm search over)) {
 -                      delete $ibx->{$f} if SvREFCNT($ibx->{$f}) == 1;
 +              if ($have_devel_peek) {
-                       foreach my $f (qw(mm search)) {
++                      foreach my $f (qw(mm search over)) {
 +                              # we bump refcnt by assigning tmp, here:
 +                              my $tmp = $ibx->{$f} or next;
 +                              next if Devel::Peek::SvREFCNT($tmp) > 2;
 +                              delete $ibx->{$f};
 +                              # refcnt is zero when tmp is out-of-scope
 +                      }
                }
                my $expire = time - 60;
                if (my $git = $ibx->{git}) {
                                $again = 1 if $git->cleanup($expire);
                        }
                }
 -              $again ||= !!($ibx->{over} || $ibx->{mm} || $ibx->{search});
 +              if ($have_devel_peek) {
-                       $again ||= !!($ibx->{mm} || $ibx->{search});
++                      $again ||= !!($ibx->{over} || $ibx->{mm} ||
++                                    $ibx->{search});
 +              }
                $next->{"$ibx"} = $ibx if $again;
        }
        $CLEANUP = $next;
index bb4bd454dd9242d51dd886ad3ae57a1c320c3e8e,b1e62f4cb0d3589327a87fb4396f6efb52ba9e2e..eae10d8ef852d3ccc9f4d03f1f2716726725e3c4
@@@ -17,6 -16,17 +16,21 @@@ use PublicInbox::SearchMsg
  use PublicInbox::MIME;
  use PublicInbox::MID qw/id_compress/;
  use PublicInbox::Over;
+ my $QP_FLAGS;
+ sub load_xapian () {
+       $QP_FLAGS ||= eval {
+               require Search::Xapian;
+               Search::Xapian->import(qw(:standard));
+               # n.b. FLAG_PURE_NOT is expensive not suitable for a public
+               # website as it could become a denial-of-service vector
++              # FLAG_PHRASE also seems to cause performance problems
++              # sometimes.
++              # TODO: make this an option, maybe?
++              # or make indexlevel=medium as default
+               FLAG_PHRASE()|FLAG_BOOLEAN()|FLAG_LOVEHATE()|FLAG_WILDCARD();
+       };
+ };
  
  # This is English-only, everything else is non-standard and may be confused as
  # a prefix common in patch emails
Simple merge
Simple merge