[Rt-commit] rt branch 5.0/provide-select-all-when-query-string-is-empty created. rt-5.0.2-277-g844dc511e5

BPS Git Server git at git.bestpractical.com
Tue Jun 21 22:26:52 UTC 2022


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".

The branch, 5.0/provide-select-all-when-query-string-is-empty has been created
        at  844dc511e5b4dd0714facdff5a191c81c68b0138 (commit)

- Log -----------------------------------------------------------------
commit 844dc511e5b4dd0714facdff5a191c81c68b0138
Author: Brian Conry <bconry at bestpractical.com>
Date:   Tue Jun 21 15:08:20 2022 -0500

    Provide default 'select all' query string
    
    Some simple search terms are simplified down to an empty string, which
    is usually construed as meaning "give me everything".  This change
    provides a default in Results.html that should generally select
    everything when no other criteria is provided.
    
    This prevents displaying an "error parsing your search query" message
    to the user when their seach term was factored away, or when they
    provided an empty search term.

diff --git a/share/html/Search/Results.html b/share/html/Search/Results.html
index e0de84d99f..ff092e6c95 100644
--- a/share/html/Search/Results.html
+++ b/share/html/Search/Results.html
@@ -113,6 +113,15 @@
 </div>
 
 <%INIT>
+# Some valid query criteria can be simplified down to an empty
+# string by the time this component is called, and in many
+# contexts (e.g. SQL) an empty criteria set is shorthand for
+# "give me everything", so default in a non-empty query that
+# will give the expected results in both of those cases.
+# This is done before the callback so that it sees the same
+# query that we're going to operate on.
+$Query ||= 'id > 0';
+
 $m->callback(
     ARGSRef          => \%ARGS,
     Query            => \$Query,

-----------------------------------------------------------------------


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list