Sort artists using sortname tag + search by name also in this tag. Fixes #44

This commit is contained in:
emeric
2020-04-04 15:34:26 +02:00
parent adf77a0842
commit 06f9673b28
5 changed files with 111 additions and 38 deletions
+4 -4
View File
@@ -901,7 +901,7 @@ handleGetArtistsRequest(RequestContext& context)
if (!user)
throw UserNotAuthorizedError {};
auto artists {Artist::getAll(context.dbSession, Artist::NameSortMethod::ByName)};
auto artists {Artist::getAll(context.dbSession, Artist::SortMethod::BySortName)};
for (const Artist::pointer& artist : artists)
indexNode.addArrayChild("artist", artistToResponseNode(user, artist, true /* id3 */));
@@ -932,7 +932,7 @@ handleGetMusicDirectoryRequest(RequestContext& context)
{
directoryNode.setAttribute("name", "Music");
auto artists {Artist::getAll(context.dbSession, Artist::NameSortMethod::ByName)};
auto artists {Artist::getAll(context.dbSession, Artist::SortMethod::BySortName)};
for (const Artist::pointer& artist : artists)
directoryNode.addArrayChild("child", artistToResponseNode(user, artist, false /* no id3 */));
@@ -1028,7 +1028,7 @@ handleGetIndexesRequest(RequestContext& context)
if (!user)
throw UserNotAuthorizedError {};
auto artists {Artist::getAll(context.dbSession, Artist::NameSortMethod::ByName)};
auto artists {Artist::getAll(context.dbSession, Artist::SortMethod::BySortName)};
for (const Artist::pointer& artist : artists)
indexNode.addArrayChild("artist", artistToResponseNode(user, artist, false /* no id3 */));
@@ -1317,7 +1317,7 @@ handleSearchRequestCommon(RequestContext& context, bool id3)
bool more;
{
auto artists {Artist::getByFilter(context.dbSession, {}, keywords, std::nullopt, Artist::NameSortMethod::ByName, artistOffset, artistCount, more)};
auto artists {Artist::getByFilter(context.dbSession, {}, keywords, std::nullopt, Artist::SortMethod::BySortName, artistOffset, artistCount, more)};
for (const Artist::pointer& artist : artists)
searchResult2Node.addArrayChild("artist", artistToResponseNode(user, artist, id3));
}