about summary refs log tree commit homepage
path: root/lib/PublicInbox/LeiXSearch.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-09-11 00:19:17 +0000
committerEric Wong <e@80x24.org>2021-09-11 00:24:16 +0000
commit57fed2e4b78ed394db38ac6d9b9227722d546d98 (patch)
tree8bdeef606aff72e7bf255b06eff892ac05d60400 /lib/PublicInbox/LeiXSearch.pm
parent0c2eaee968cb59ae60c10ce89b2c236fd9369830 (diff)
downloadpublic-inbox-57fed2e4b78ed394db38ac6d9b9227722d546d98.tar.gz
Having redundant "+" in URLs is ugly and can hurt cacheability
of queries.  Even with "quoted phrase searches", Xapian seems
unaffected by redundant spaces, so just normalize the ASCII
white spaces to ' ' (%20) when fed via STDIN or saved-search
config file.

Reported-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Link: https://public-inbox.org/meta/20210910141157.6u5adehpx7wftkor@meerkat.local/
Diffstat (limited to 'lib/PublicInbox/LeiXSearch.pm')
-rw-r--r--lib/PublicInbox/LeiXSearch.pm4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/PublicInbox/LeiXSearch.pm b/lib/PublicInbox/LeiXSearch.pm
index 709a3b3a..9f7f3885 100644
--- a/lib/PublicInbox/LeiXSearch.pm
+++ b/lib/PublicInbox/LeiXSearch.pm
@@ -297,7 +297,9 @@ sub query_remote_mboxrd {
         local $SIG{TERM} = sub { exit(0) }; # for DESTROY (File::Temp, $reap)
         my $lei = $self->{lei};
         my $opt = $lei->{opt};
-        my @qform = (q => $lei->{mset_opt}->{qstr}, x => 'm');
+        my $qstr = $lei->{mset_opt}->{qstr};
+        $qstr =~ s/[ \n\t]+/ /sg; # make URLs less ugly
+        my @qform = (q => $qstr, x => 'm');
         push(@qform, t => 1) if $opt->{threads};
         my $verbose = $opt->{verbose};
         my ($reap_tail, $reap_curl);