Skip to content
Snippets Groups Projects
Verified Commit 031d96a0 authored by Eliot Berriot's avatar Eliot Berriot
Browse files

Return shorter search results on Subsonic API

parent ffe42907
No related branches found
No related tags found
No related merge requests found
......@@ -10,7 +10,7 @@ from rest_framework.serializers import ValidationError
import funkwhale_api
from funkwhale_api.activity import record
from funkwhale_api.common import preferences
from funkwhale_api.common import preferences, utils as common_utils
from funkwhale_api.favorites.models import TrackFavorite
from funkwhale_api.music import models as music_models
from funkwhale_api.music import utils
......@@ -345,6 +345,7 @@ class SubsonicViewSet(viewsets.GenericViewSet):
utils.get_query(query, c["search_fields"])
)
queryset = queryset.playable_by(actor)
queryset = common_utils.order_for_search(queryset, c["search_fields"][0])
queryset = queryset[offset : offset + size]
payload["searchResult3"][c["subsonic"]] = c["serializer"](queryset)
return response.Response(payload)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment