about summary refs log tree commit homepage
path: root/lib/PublicInbox/SearchIdx.pm
diff options
authorEric Wong <e@80x24.org>2019-05-29 20:56:32 +0000
committerEric Wong <e@80x24.org>2019-05-29 20:56:59 +0000
commit3c9ab47c7d0e26fd22e1f42a198696b093629802 (patch)
treeaa6df6d879d82ced06add1d4869c81336d2664e5 /lib/PublicInbox/SearchIdx.pm
parent4f814ff418e334a9b7b9bd96cd5450c2823de2f6 (diff)
And use it from Admin.

It's easy to tell what indexlevel=basic is from unconfigured
inboxes, but distinguishing between 'medium' and 'full' would
require stat()-ing position.* files which is fragile and

So use the metadata facility of Xapian and store it in the main
partition so Admin tools can deal better with unconfigured
inboxes copied using generic tools like cp(1) or rsync(1).
Diffstat (limited to 'lib/PublicInbox/SearchIdx.pm')
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm
index b963805e..99856286 100644
--- a/lib/PublicInbox/SearchIdx.pm
+++ b/lib/PublicInbox/SearchIdx.pm
@@ -828,6 +828,14 @@ sub commit_txn_lazy {
         delete $self->{txn} or return;
         $self->{-inbox}->with_umask(sub {
                 if (my $xdb = $self->{xdb}) {
+                        # store 'indexlevel=medium' in v2 part=0 and v1 (only part)
+                        # This metadata is read by Admin::detect_indexlevel:
+                        if (!$self->{partition} # undef or 0, not >0
+                            && $self->{indexlevel} eq 'medium') {
+                                $xdb->set_metadata('indexlevel', 'medium');
+                        }
                 $self->{over}->commit_lazy if $self->{over};