handle download queue search

This commit is contained in:
Simon
2025-07-10 11:29:50 +07:00
parent 83404628e6
commit ffd3bab948
4 changed files with 35 additions and 4 deletions

View File

@@ -47,6 +47,7 @@ class DownloadListQuerySerializer(
)
channel = serializers.CharField(required=False, help_text="channel ID")
page = serializers.IntegerField(required=False)
q = serializers.CharField(required=False, help_text="Search Query")
class DownloadListQueueDeleteQuerySerializer(serializers.Serializer):

View File

@@ -73,6 +73,10 @@ class DownloadApiListView(ApiBaseView):
{"term": {"vid_type": {"value": vid_type_filter}}}
)
search_query = validated_data.get("q")
if search_query:
must_list.append({"match_phrase_prefix": {"title": search_query}})
self.data["query"] = {"bool": {"must": must_list}}
self.get_document_list(request)