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 <dysprozin@gmail.com>
This commit is contained in:
DySprozin 2025-11-28 09:13:36 +03:00 committed by GitHub
parent a30528f358
commit 20ac5ef807
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 0 deletions

View File

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

View File

@ -104,6 +104,10 @@ const SearchExampleQueries = () => {
auto-generated subtitles only, or <i>user</i> to search through user-uploaded
subtitles only
</li>
<li>
<span>channel:</span> limit subtitle search to a specific channel name (for
example: <code>full:javascript channel:corey schafer</code>)
</li>
</ul>
</li>
</ul>