diff --git a/src/invidious/routes/search.cr b/src/invidious/routes/search.cr index 3f1e219f..486f121f 100644 --- a/src/invidious/routes/search.cr +++ b/src/invidious/routes/search.cr @@ -54,17 +54,11 @@ module Invidious::Routes::Search user = env.get? "user" begin - search_query, count, videos, operators = process_search_query(query, page, user, region: region) + search_query, count, items, operators = process_search_query(env.params.query, query, page, user, region: nil) rescue ex return error_template(500, ex) end - operator_hash = {} of String => String - operators.each do |operator| - key, value = operator.downcase.split(":") - operator_hash[key] = value - end - env.set "search", query templated "search" end diff --git a/src/invidious/search.cr b/src/invidious/search.cr index fd592f39..0228ec61 100644 --- a/src/invidious/search.cr +++ b/src/invidious/search.cr @@ -183,7 +183,7 @@ def process_search_query(url_params, query, page, user, region) sort = "relevance" subscriptions = nil - # operators = url_params.split(" ").select { |a| a.match(/\w+:[\,]+/) } + # operators = query.split(" ").select { |a| a.match(/\w+:[\w,]+/) } url_params.each do |operator| key, value = operator @@ -238,14 +238,14 @@ def process_search_query(url_params, query, page, user, region) items.each do |i| if i.is_a? Category i.contents.each do |cate_items| - if cate_items.is_a? (SearchVideo | SearchPlaylist | SearchChannel) + if cate_items.is_a?(SearchVideo | SearchPlaylist | SearchChannel) extracted_items << cate_items end end else extracted_items << i end - end + end - {search_query, count, extracted_items, url_params} + {search_query, count, items, url_params} end diff --git a/src/invidious/views/search.ecr b/src/invidious/views/search.ecr index 806584cc..f6489909 100644 --- a/src/invidious/views/search.ecr +++ b/src/invidious/views/search.ecr @@ -18,123 +18,125 @@