Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
6892ef9b
Unverified
Commit
6892ef9b
authored
6 years ago
by
Ryan Senior
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #7885 from metabase/fix-search-string-npe
Fix NullPointerException when not including a search string
parents
e918bfcd
414fcb1f
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/metabase/api/search.clj
+1
-1
1 addition, 1 deletion
src/metabase/api/search.clj
test/metabase/api/search_test.clj
+10
-1
10 additions, 1 deletion
test/metabase/api/search_test.clj
with
11 additions
and
2 deletions
src/metabase/api/search.clj
+
1
−
1
View file @
6892ef9b
...
...
@@ -196,7 +196,7 @@
(
s/defn
^
:private
make-search-context
:-
SearchContext
[
search-string
:-
(
s/maybe
su/NonBlankString
)
archived-string
:-
(
s/maybe
su/BooleanString
)]
{
:search-string
(
str
"%"
(
str/lower-case
search-string
)
"%"
)
{
:search-string
search-string
:archived?
(
Boolean/parseBoolean
archived-string
)
:visible-collections
(
coll/permissions-set->visible-collection-ids
@
*current-user-permissions-set*
)})
...
...
This diff is collapsed.
Click to expand it.
test/metabase/api/search_test.clj
+
10
−
1
View file @
6892ef9b
(
ns
metabase.api.search-test
(
:require
[
clojure.string
:as
str
]
(
:require
[
clojure.set
:as
set
]
[
clojure.string
:as
str
]
[
expectations
:refer
:all
]
[
metabase.models
[
card
:refer
[
Card
]]
...
...
@@ -85,6 +86,14 @@
(
with-search-items-in-root-collection
"test"
(
search-request
:crowberto
:q
"test"
)))
;; Search with no search string. Note this search everything in the DB, including any stale data left behind from
;; previous tests. Instead of an = comparison here, just ensure our default results are included
(
expect
(
set/subset?
default-search-results
(
with-search-items-in-root-collection
"test"
(
search-request
:crowberto
))))
;; Ensure that users without perms for the root collection don't get results
;; NOTE: Metrics and segments don't have collections, so they'll be returned
(
expect
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment