Fix search filters

pull/143/head
Omar Roth 6 years ago
parent ed8ddbc07d
commit 917d220623

@ -450,11 +450,11 @@ get "/search" do |env|
end end
end end
query = (query.split(" ") - operators).join(" ") search_query = (query.split(" ") - operators).join(" ")
search_params = build_search_params(sort: sort, date: date, content_type: "video", search_params = build_search_params(sort: sort, date: date, content_type: "video",
duration: duration, features: features) duration: duration, features: features)
count, videos = search(query, page, search_params).as(Tuple) count, videos = search(search_query, page, search_params).as(Tuple)
templated "search" templated "search"
end end

@ -38,9 +38,9 @@ def build_search_params(sort : String = "relevance", date : String = "", content
"\x00" "\x00"
when "rating" when "rating"
"\x01" "\x01"
when "upload_date" when "upload_date", "date"
"\x02" "\x02"
when "view_count" when "view_count", "views"
"\x03" "\x03"
else else
raise "No sort #{sort}" raise "No sort #{sort}"
@ -92,7 +92,7 @@ def build_search_params(sort : String = "relevance", date : String = "", content
"\x20\x01" "\x20\x01"
when "subtitles" when "subtitles"
"\x28\x01" "\x28\x01"
when "creative_commons" when "creative_commons", "cc"
"\x30\x01" "\x30\x01"
when "3d" when "3d"
"\x38\x01" "\x38\x01"

@ -1,5 +1,5 @@
<% content_for "header" do %> <% content_for "header" do %>
<title><%= query.not_nil!.size > 30 ? query.not_nil![0,30].rstrip(".") + "..." : query.not_nil! %> - Invidious</title> <title><%= search_query.not_nil!.size > 30 ? query.not_nil![0,30].rstrip(".") + "..." : query.not_nil! %> - Invidious</title>
<% end %> <% end %>
<% videos.each_slice(4) do |slice| %> <% videos.each_slice(4) do |slice| %>

Loading…
Cancel
Save