about summary refs log tree commit homepage
path: root/lib/PublicInbox/SearchQuery.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-06-23 07:14:21 -0400
committerEric Wong <e@80x24.org>2021-06-23 19:24:49 +0000
commit520be116e8a686cb223b48fad1de29201dee45be (patch)
treea20d7a81be01fd67c6346efe5e06f05be02f58d8 /lib/PublicInbox/SearchQuery.pm
parent4d594e98063aaad1ce9a90709af7edc5c44a0163 (diff)
downloadpublic-inbox-520be116e8a686cb223b48fad1de29201dee45be.tar.gz
When dealing with thousands of inboxes, displaying all of
them on a single page isn't going to work.  So steal some
pagination and search results code from the message search
to generate some basic HTML output that looks good in w3m.
Diffstat (limited to 'lib/PublicInbox/SearchQuery.pm')
-rw-r--r--lib/PublicInbox/SearchQuery.pm13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/PublicInbox/SearchQuery.pm b/lib/PublicInbox/SearchQuery.pm
index 0f360500..a6b7d843 100644
--- a/lib/PublicInbox/SearchQuery.pm
+++ b/lib/PublicInbox/SearchQuery.pm
@@ -1,7 +1,7 @@
 # Copyright (C) 2015-2021 all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 
-# used by PublicInbox::SearchView
+# used by PublicInbox::SearchView and PublicInbox::WwwListing
 package PublicInbox::SearchQuery;
 use strict;
 use v5.10.1;
@@ -32,11 +32,12 @@ sub qs_html {
         if (scalar(keys(%override))) {
                 $self = bless { (%$self, %override) }, ref($self);
         }
-
-        my $q = uri_escape($self->{'q'}, MID_ESC);
-        $q =~ s/%20/+/g; # improve URL readability
-        my $qs = "q=$q";
-
+        my $qs = '';
+        if (defined(my $q = $self->{'q'})) {
+                $q = uri_escape($q, MID_ESC);
+                $q =~ s/%20/+/g; # improve URL readability
+                $qs .= "q=$q";
+        }
         if (my $o = $self->{o}) { # ignore o == 0
                 $qs .= "&amp;o=$o";
         }