Skip to content

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

Protect against nil search_vector (#63172)

Chris Truterf09dbce65dd7
diff --git a/src/metabase/search/appdb/specialization/postgres.clj b/src/metabase/search/appdb/specialization/postgres.clj
index e0f55b38b77..8aa5bef3f22 100644
--- a/src/metabase/search/appdb/specialization/postgres.clj
+++ b/src/metabase/search/appdb/specialization/postgres.clj
@@ -55,12 +55,12 @@
(defmethod specialization/extra-entry-fields :postgres [entity]
{:search_vector
[:||
- (search.util/weighted-tsvector "A" (:name entity))
- (search.util/weighted-tsvector "B" (:searchable_text entity ""))]
+ (search.util/weighted-tsvector "A" (or (:name entity) ""))
+ (search.util/weighted-tsvector "B" (or (:searchable_text entity) ""))]
:with_native_query_vector
[:||
- (search.util/weighted-tsvector "A" (:name entity))
+ (search.util/weighted-tsvector "A" (or (:name entity) ""))
(search.util/weighted-tsvector "B" (str/join " " (keep entity [:searchable_text :native_query])))]})
;; See https://www.postgresql.org/docs/current/textsearch-controls.html#TEXTSEARCH-RANKING