mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-08-14.git
synced 2024-08-15 00:53:20 +00:00
Extract items from category for search in frontend
This commit is contained in:
parent
420c2be348
commit
d3a9e8554c
1 changed files with 16 additions and 1 deletions
|
@ -231,5 +231,20 @@ def process_search_query(url_params, query, page, user, region)
|
|||
count, items = search(search_query, search_params, region).as(Tuple)
|
||||
end
|
||||
|
||||
{search_query, count, items, url_params}
|
||||
# Light processing to extract items from categories.
|
||||
# Categories should ideally be supported in the frontend in the future
|
||||
extracted_items = [] of SearchItem | ChannelVideo
|
||||
items.each do |i|
|
||||
if i.is_a? Category
|
||||
i.contents.each do |cate_items|
|
||||
if cate_items.is_a? (SearchVideo | SearchPlaylist | SearchChannel)
|
||||
extracted_items << cate_items
|
||||
end
|
||||
end
|
||||
else
|
||||
extracted_items << i
|
||||
end
|
||||
end
|
||||
|
||||
{search_query, count, extracted_items, url_params}
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue