mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 15:28:37 +08:00
Add backend code for searching by filetypes.
This commit is contained in:
@ -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
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user