mirror of
https://github.com/discourse/discourse.git
synced 2025-06-03 19:39:30 +08:00
Add backend code for searching by filetypes.
This commit is contained in:
@ -456,6 +456,15 @@ class Search
|
|||||||
)", tags)
|
)", tags)
|
||||||
end
|
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
|
private
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user