Add default descending semver ordering to collection version search - #2571
Conversation
| @@ -87,6 +90,12 @@ def get_queryset(self): | |||
|
|
|||
| return qs | |||
There was a problem hiding this comment.
What if you return qs.order_by("-version") here?
There was a problem hiding this comment.
I meant "here". I don't think you need to introduce a whole new codepath.
The cross-repo search endpoint returns versions in arbitrary order when no order_by parameter is passed. Add default descending version ordering in get_queryset so versions display newest-first. Explicit order_by and full-text search ordering replace it. Fixes: AAP-78435 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2421608 to
d990016
Compare
Backport to 0.29: 💚 backport PR created✅ Backport PR branch: Backported as #2603 🤖 @patchback |
Backport to 0.25: 💚 backport PR created✅ Backport PR branch: Backported as #2604 🤖 @patchback |
Backport to 0.28: 💚 backport PR created✅ Backport PR branch: Backported as #2605 🤖 @patchback |
Backport to 0.30: 💚 backport PR created✅ Backport PR branch: Backported as #2606 🤖 @patchback |
The cross-repo search endpoint (
v3/plugin/ansible/search/collection-versions/)returns versions in arbitrary order when no
order_byparameter is passed.This causes version dropdowns to display 4.7.10 before 4.7.5 (string sorting).
Adds a
filter_querysetoverride that applies descending semver orderingusing the existing
SemanticVersionOrderingFilterwhen no explicit orderingis requested. Explicit
order_byand full-text search?q=ordering arepreserved.
Fixes: AAP-78435
Also addresses: AAP-56212
Tested on AAP 2.6-next using aap-dev. Verified: