diff --git a/lib/search.rb b/lib/search.rb index 543149b18e2..f3ea5ccd824 100644 --- a/lib/search.rb +++ b/lib/search.rb @@ -456,6 +456,15 @@ class Search )", tags) end + advanced_filter(/filetypes?:([a-zA-Z0-9,\-_]+)/) do |posts, match| + file_extensions = match.split(",") + + posts.where("posts.id IN ( + SELECT post_id FROM topic_links + WHERE extension IN (?) + )", file_extensions) + end + private