Respect Mopidy's search result order instead of forcing alphabetical sort - #1018
AirplanegoBrr wants to merge 2 commits into
Conversation
… sort, and apply it to search views
|
Looks like this is a semi-duplicate of #995 — that one also fixes the Would be good to know whether @jaedb or any maintainers want "As Loaded" to be the default, or left as opt-in via the dropdown. |
|
Looks great, I can see you've put in a good chunk of thought here. How does it function when multiple sources are specified? For instance, when searching across Spotify, Youtube, Mopidy and whatever other extension users may have installed. How is the search order managed in that scenario? |
Why no default sort order?
Because we want to respect the order Mopidy actually gives us back.
Right now search results default to sorting by name (
'name'as the default sort field). This throws away the ranking that Mopidy's backends already computed for you, and just relists everything alphabetically instead.I noticed this because I was building my own Mopidy client, and my search results were consistently better than what Iris was showing me for the same query. Digging into why, I found Iris was overriding the order and sorting by name instead of leaving it alone. For what it's worth, the ordering coming through looks a lot like what the Spotify API returns for the same search — not sure if that's Mopidy itself or the mopidy-spotify plugin doing that, but either way it's more relevant than alphabetical.
Playlist results are noticeably more relevant now too, not just random stuff.
This might be related to #933 and #974.
What this changes
getSortSelectorgoes from'name'tonullin bothSearchResults.jsandSearch.js, so results render in whatever order Mopidy returned them in, unless the user explicitly picks a sort option themselves.getSortSelectoralso had a bug that made passingnullas the default pointless- so it would fall back to "Name" any time there was no active sort, instead of only when there was truly no stored state. Fixed so it actually respects anulldefault.Before / after
Before: searching for a song, the actual track I wanted was 20 results down. Crazy! Almost makes the search UNUSABLE.

After: same search - it's the first result.

Also worth noting, as mentioned in a comment on #933, searching "sefa infinity" put the actual track as the 27th result. With this change it's the first result, hopeful
@mczerskiwill be able to be laid again!Testing