Sort the library ignoring case and accents - #293
Merged
Merged
Conversation
The library ordered names by their bytes, as SQLite does, so "abba" came after "ZZ Top", and "Émile" after both. It now orders them with the LOCALIZED collation Android's SQLite has, as the phone's language does, the way search results are ordered. Songs stay in disc and track order. Release-note: The library lists artists and albums in alphabetical order, whatever their case or accents. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012foWs5vBJrYTDtfyFhJ3ky
hatstand
enabled auto-merge (rebase)
September 30, 2026 09:52
hatstand
disabled auto-merge
September 30, 2026 09:55
After ordering names with the LOCALIZED collation, the library orders equal names by their bytes, so names differing only in case are in a fixed order, "Apple" before "apple", whatever the device's collation makes of them. The iOS client does the same. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012foWs5vBJrYTDtfyFhJ3ky
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The library ordered names the way SQLite does by default, by their bytes, so "abba" came after "ZZ Top", and "Émile" after both.
DynamicSongQuerynow orders each level with Android SQLite's built-in ICU collation,COLLATE LOCALIZED, which sorts the way the phone's language does, like search results. SQLite's ownNOCASEwasn't enough: it only folds ASCII.ORDER BY <field> COLLATE LOCALIZED ASC|DESC.ORDER BY album COLLATE LOCALIZED, disc, track, so an album's songs stay in track order.The library database isn't opened with
NO_LOCALIZED_COLLATORS, so the collation is available on read-only connections.The iOS client gets the same change in clementine-player/iOS-Remote#17. It registers a collation of the same name, so both clients run the same SQL.
Tests: the new
DynamicSongQueryTestcovers:It failed against the old query and passes with the new one.
LibraryScreenTestandSearchScreenTeststill pass.🤖 Generated with Claude Code
https://claude.ai/code/session_012foWs5vBJrYTDtfyFhJ3ky