From 66fb02acad5c336e22e00150c133dd2f342c8d1f Mon Sep 17 00:00:00 2001 From: Mittineague Date: Mon, 9 May 2016 16:20:35 -0400 Subject: [PATCH] Permit in topic search when full name is null (#4217) * Permit in topic search when full name is null * as per @gschlager and @ZogStriP pull 4217 --- lib/search.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/search.rb b/lib/search.rb index 224c14c35c4..d66bfa9391b 100644 --- a/lib/search.rb +++ b/lib/search.rb @@ -481,7 +481,7 @@ class Search if @term.present? if is_topic_search posts = posts.joins('JOIN users u ON u.id = posts.user_id') - posts = posts.where("posts.raw || ' ' || u.username || ' ' || u.name ilike ?", "%#{@term}%") + posts = posts.where("posts.raw || ' ' || u.username || ' ' || COALESCE(u.name, '') ilike ?", "%#{@term}%") else posts = posts.where("post_search_data.search_data @@ #{ts_query}") exact_terms = @term.scan(/"([^"]+)"/).flatten