about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2018-07-20 06:58:45 +0000
committerEric Wong <e@80x24.org>2018-07-20 07:02:08 +0000
commitea54cfe8dad656021517b32c76f0893979fb001b (patch)
tree6d12a86947e52e414d35bbac7587f9e7801e7fdd /lib
parent4caa768779a9b417321736b090d50f3421a799de (diff)
downloadpublic-inbox-ea54cfe8dad656021517b32c76f0893979fb001b.tar.gz
For v1 repos, we don't need to write any metadata to Xapian
and changing from 'basic' to 'medium' or 'full' will work.

For v2, the metadata for indexing is stored in msgmap (because
the Xapian databases are partitioned for parallelism), so a
reindex is required.
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/SearchIdx.pm5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm
index bb60506c..1d259a86 100644
--- a/lib/PublicInbox/SearchIdx.pm
+++ b/lib/PublicInbox/SearchIdx.pm
@@ -27,6 +27,8 @@ use constant {
         DEBUG => !!$ENV{DEBUG},
 };
 
+my $xapianlevels = qr/\A(?:full|medium)\z/;
+
 my %GIT_ESC = (
         a => "\a",
         b => "\b",
@@ -365,7 +367,6 @@ sub add_xapian ($$$$$) {
 sub add_message {
         # mime = Email::MIME object
         my ($self, $mime, $bytes, $num, $oid, $mid0) = @_;
-        my $xapianlevels = qr/\A(?:full|medium)\z/;
         my $mids = mids($mime->header_obj);
         $mid0 = $mids->[0] unless defined $mid0; # v1 compatibility
         unless (defined $num) { # v1
@@ -714,7 +715,7 @@ sub _index_sync {
                         }
                         $dbh->commit;
                 }
-                if ($mkey && $newest) {
+                if ($mkey && $newest && $self->{indexlevel} =~ $xapianlevels) {
                         my $cur = $xdb->get_metadata($mkey);
                         if (need_update($self, $cur, $newest)) {
                                 $xdb->set_metadata($mkey, $newest);