FEATURE: add name and username to search within topic
This commit is contained in:
parent
68e56db61c
commit
05eff38f34
|
@ -255,7 +255,8 @@ class Search
|
||||||
.where("topics.archetype <> ?", Archetype.private_message)
|
.where("topics.archetype <> ?", Archetype.private_message)
|
||||||
|
|
||||||
if @search_context.present? && @search_context.is_a?(Topic)
|
if @search_context.present? && @search_context.is_a?(Topic)
|
||||||
posts = posts.where("posts.raw ilike ?", "%#{@term}%")
|
posts = posts.joins('JOIN users u ON u.id = posts.user_id')
|
||||||
|
posts = posts.where("posts.raw || ' ' || u.username || ' ' || u.name ilike ?", "%#{@term}%")
|
||||||
else
|
else
|
||||||
posts = posts.where("post_search_data.search_data @@ #{ts_query}")
|
posts = posts.where("post_search_data.search_data @@ #{ts_query}")
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue