Add backend code for searching by filetypes.

This commit is contained in:
Jakub Macina 2017-06-20 21:20:06 +02:00
parent 67ce4b70a6
commit f87d32ac6d

View File

@ -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