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
This commit is contained in:
Mittineague 2016-05-09 16:20:35 -04:00 committed by Régis Hanol
parent d224966a0e
commit 66fb02acad
1 changed files with 1 additions and 1 deletions

View File

@ -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