]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/SearchIdx.pm
v1: allow upgrading indexlevel=basic to 'medium' or 'full'
[public-inbox.git] / lib / PublicInbox / SearchIdx.pm
index bb60506ce1a9996e1d6a9971e61459cf13b250b7..1d259a8642a38a81677b30253e469592cf5ab5e8 100644 (file)
@@ -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);