Add channel filter support to subtitle search queries

This commit is contained in:
Dmitry Sprozin 2025-11-25 00:50:40 +03:00
parent a30528f358
commit f99a6cdf69
1 changed files with 17 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(
{