Fix(subsonic): missing default order for search3
This commit is contained in:
parent
51788a324c
commit
209e118882
|
@ -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):
|
||||||
|
|
|
@ -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(
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Fixed unpredictable subsonic search3 results (#1782)
|
Loading…
Reference in New Issue