Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Fix edge case in to-tsquery-expr (#64330)

Noah Moss16c4a16025e8
diff --git a/src/metabase/search/util.clj b/src/metabase/search/util.clj
index dd33c8f5f71..1d11ed93e9e 100644
--- a/src/metabase/search/util.clj
+++ b/src/metabase/search/util.clj
@@ -147,6 +147,7 @@
(partition-by #{"or"})
(remove #(= (first %) "or"))
(map process-clause)
+ (remove str/blank?)
(str/join " | ")
maybe-complete)))))
diff --git a/test/metabase/search/util_test.clj b/test/metabase/search/util_test.clj
index 1c027b1f852..2066854019f 100644
--- a/test/metabase/search/util_test.clj
+++ b/test/metabase/search/util_test.clj
@@ -40,6 +40,9 @@
(is (= "'a' & 'b' | 'c':*"
(search-expr "a b or c")))
+ (is (= "'a' | 'b':*"
+ (search-expr "a or and or b")))
+
(is (= "'this' & !'that':*"
(search-expr "this -that")))