From 20ac5ef807722361b15f2514d3be6a776aac4cc7 Mon Sep 17 00:00:00 2001 From: DySprozin Date: Fri, 28 Nov 2025 09:13:36 +0300 Subject: [PATCH] Add support for channel-specific filtering in subtitle search (#1096) * Add channel filter support to subtitle search queries * Update search examples to include channel filter option --------- Co-authored-by: Dmitry Sprozin --- backend/common/src/searching.py | 17 +++++++++++++++++ .../src/components/SearchExampleQueries.tsx | 4 ++++ 2 files changed, 21 insertions(+) diff --git a/backend/common/src/searching.py b/backend/common/src/searching.py index 17c164b1..44b75d0b 100644 --- a/backend/common/src/searching.py +++ b/backend/common/src/searching.py @@ -113,6 +113,7 @@ class SearchParser: "index": "ta_subtitle", "lang": [], "source": [], + "channel": [], }, } @@ -345,6 +346,22 @@ class QueryBuilder: """build query for fulltext search""" must_list = [] + if (channel := self.query_map.get("channel")) is not None: + must_list.append( + { + "multi_match": { + "query": channel, + "type": "bool_prefix", + "fuzziness": self._get_fuzzy(), + "operator": "and", + "fields": [ + "subtitle_channel", + "subtitle_channel.keyword", + ], + } + } + ) + if (term := self.query_map.get("term")) is not None: must_list.append( { diff --git a/frontend/src/components/SearchExampleQueries.tsx b/frontend/src/components/SearchExampleQueries.tsx index 1c181c6e..a4822b61 100644 --- a/frontend/src/components/SearchExampleQueries.tsx +++ b/frontend/src/components/SearchExampleQueries.tsx @@ -104,6 +104,10 @@ const SearchExampleQueries = () => { auto-generated subtitles only, or user to search through user-uploaded subtitles only +
  • + channel: — limit subtitle search to a specific channel name (for + example: full:javascript channel:corey schafer) +