Fix(subsonic): missing default order for search3

This commit is contained in:
Marcos Peña 2022-07-19 15:16:00 +00:00 committed by Georg Krause
parent 51788a324c
commit 209e118882
3 changed files with 3 additions and 2 deletions

View File

@ -187,7 +187,7 @@ def order_for_search(qs, field):
When searching, it's often more useful to have short results first, When searching, it's often more useful to have short results first,
this function will order the given qs based on the length of the given field this function will order the given qs based on the length of the given field
""" """
return qs.annotate(__size=models.functions.Length(field)).order_by("__size") return qs.annotate(__size=models.functions.Length(field)).order_by("__size", "pk")
def recursive_getattr(obj, key, permissive=False): def recursive_getattr(obj, key, permissive=False):

View File

@ -566,7 +566,7 @@ class SubsonicViewSet(viewsets.GenericViewSet):
except (TypeError, KeyError, ValueError): except (TypeError, KeyError, ValueError):
size = 20 size = 20
size = min(size, 100) size = min(size, 500)
queryset = c["queryset"] queryset = c["queryset"]
if query: if query:
queryset = c["queryset"].filter( queryset = c["queryset"].filter(

View File

@ -0,0 +1 @@
Fixed unpredictable subsonic search3 results (#1782)