mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 07:38:01 +08:00
Add backend code for searching by filetypes.
This commit is contained in:
parent
67ce4b70a6
commit
f87d32ac6d
|
@ -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
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user