about summary refs log tree commit homepage
path: root/lib/PublicInbox/SearchView.pm
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-08-22 06:06:27 +0000
committerEric Wong <e@yhbt.net>2020-08-23 00:19:53 +0000
commita367ec1b15a2458e532245f5308565dd84f8ca63 (patch)
tree97f5c7fc52301282ff9a5f1c9913f3827edd3b49 /lib/PublicInbox/SearchView.pm
parentaad1b9e70529b78d3d7d62b0920ad82ca40f9592 (diff)
downloadpublic-inbox-a367ec1b15a2458e532245f5308565dd84f8ca63.tar.gz
mbox: disable "&t" on existing Xapian until full reindex
Expanding threads via over.sqlite3 for mbox.gz downloads without
Xapian effectively collapsing on the THREADID column leads to
repeated messages getting downloaded.

To avoid that situation, use a "has_threadid" Xapian metadata
flag that's only set on --reindex (and brand new Xapian DBs).

This allows admins to upgrade WWW or do --reindex in any order;
without worrying about users eating up bandwidth and CPU cycles.
Diffstat (limited to 'lib/PublicInbox/SearchView.pm')
-rw-r--r--lib/PublicInbox/SearchView.pm21
1 files changed, 14 insertions, 7 deletions
diff --git a/lib/PublicInbox/SearchView.pm b/lib/PublicInbox/SearchView.pm
index dd69564a..76428dfb 100644
--- a/lib/PublicInbox/SearchView.pm
+++ b/lib/PublicInbox/SearchView.pm
@@ -188,13 +188,20 @@ sub search_nav_top {
                 $rv .= qq{<a\nhref="?$s">summary</a>|<b>nested</b>};
         }
         my $A = $q->qs_html(x => 'A', r => undef);
-        $rv .= qq{|<a\nhref="?$A">Atom feed</a>]} .
-                qq{\n\t\t\tdownload mbox.gz: } .
-                # we set name=z w/o using it since it seems required for
-                # lynx (but works fine for w3m).
-                qq{<input\ntype=submit\nname=z\nvalue="results only"/>|} .
-                qq{<input\ntype=submit\nname=x\nvalue="full threads"/>} .
-                qq{</pre></form><pre>};
+        $rv .= qq{|<a\nhref="?$A">Atom feed</a>]};
+        if ($ctx->{-inbox}->search->has_threadid) {
+                $rv .= qq{\n\t\t\tdownload mbox.gz: } .
+                        # we set name=z w/o using it since it seems required for
+                        # lynx (but works fine for w3m).
+                        qq{<input\ntype=submit\nname=z\n} .
+                                q{value="results only"/>} .
+                        qq{|<input\ntype=submit\nname=x\n} .
+                                q{value="full threads"/>};
+        } else { # BOFH needs to --reindex
+                $rv .= qq{\n\t\t\t\t\t\tdownload: } .
+                        qq{<input\ntype=submit\nname=z\nvalue="mbox.gz"/>}
+        }
+        $rv .= qq{</pre></form><pre>};
 }
 
 sub search_nav_bot {