diff --git a/api/funkwhale_api/common/utils.py b/api/funkwhale_api/common/utils.py index 061169ab8..f252aeac9 100644 --- a/api/funkwhale_api/common/utils.py +++ b/api/funkwhale_api/common/utils.py @@ -187,7 +187,7 @@ def order_for_search(qs, field): 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 """ - 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): diff --git a/api/funkwhale_api/subsonic/views.py b/api/funkwhale_api/subsonic/views.py index 8ea2fba5a..dd5ca3111 100644 --- a/api/funkwhale_api/subsonic/views.py +++ b/api/funkwhale_api/subsonic/views.py @@ -566,7 +566,7 @@ class SubsonicViewSet(viewsets.GenericViewSet): except (TypeError, KeyError, ValueError): size = 20 - size = min(size, 100) + size = min(size, 500) queryset = c["queryset"] if query: queryset = c["queryset"].filter( diff --git a/changes/changelog.d/1782.bugfix b/changes/changelog.d/1782.bugfix new file mode 100644 index 000000000..81b2745e4 --- /dev/null +++ b/changes/changelog.d/1782.bugfix @@ -0,0 +1 @@ +Fixed unpredictable subsonic search3 results (#1782)