Fixed results inconsistencies when using search3

This commit is contained in:
emeric
2024-04-19 08:56:48 +02:00
parent 38d0115069
commit 697233dcef
10 changed files with 29 additions and 14 deletions
@@ -197,7 +197,7 @@ namespace lms::api::subsonic
{
feedback::IFeedbackService::ArtistFindParameters artistFindParams;
artistFindParams.setUser(context.userId);
artistFindParams.setSortMethod(ArtistSortMethod::BySortName);
artistFindParams.setSortMethod(ArtistSortMethod::SortName);
for (const ArtistId artistId : feedbackService.findStarredArtists(artistFindParams).results)
{
if (auto artist{ Artist::find(context.dbSession, artistId) })
@@ -109,7 +109,7 @@ namespace lms::api::subsonic
if (!user)
throw UserNotAuthorizedError{};
parameters.setSortMethod(ArtistSortMethod::BySortName);
parameters.setSortMethod(ArtistSortMethod::SortName);
switch (user->getSubsonicArtistListMode())
{
case SubsonicArtistListMode::AllArtists:
@@ -329,7 +329,7 @@ namespace lms::api::subsonic
directoryNode.setAttribute("name", "Music");
// TODO: this does not scale when a lot of artists are present
Artist::find(context.dbSession, Artist::FindParameters{}.setSortMethod(ArtistSortMethod::BySortName), [&](const Artist::pointer& artist)
Artist::find(context.dbSession, Artist::FindParameters{}.setSortMethod(ArtistSortMethod::SortName), [&](const Artist::pointer& artist)
{
directoryNode.addArrayChild("child", createArtistNode(context, artist, user, false /* no id3 */));
});
@@ -132,6 +132,7 @@ namespace lms::api::subsonic
params.setKeywords(keywords);
params.setRange(Range{ artistOffset, artistCount });
params.setMediaLibrary(mediaLibrary);
params.setSortMethod(ArtistSortMethod::Id); // must be consistent with both methods
Artist::find(context.dbSession, params, [&](const Artist::pointer& artist)
{
@@ -197,6 +198,7 @@ namespace lms::api::subsonic
params.setKeywords(keywords);
params.setRange(Range{ albumOffset, albumCount });
params.setMediaLibrary(mediaLibrary);
params.setSortMethod(ReleaseSortMethod::Id); // must be consistent with both methods
Release::find(context.dbSession, params, [&](const Release::pointer& release)
{
@@ -262,6 +264,7 @@ namespace lms::api::subsonic
params.setKeywords(keywords);
params.setRange(Range{ songOffset, songCount });
params.setMediaLibrary(mediaLibrary);
params.setSortMethod(TrackSortMethod::Id); // must be consistent with both methods
Track::find(context.dbSession, params, [&](const Track::pointer& track)
{