Allow artist tags that can't have mbid (composer, lyricist, etc.) to fallback on artists which have mbid (track artists, release artists)

This commit is contained in:
emeric
2020-11-18 09:21:34 +01:00
parent 633ce7d392
commit c7e76de419
4 changed files with 33 additions and 21 deletions
+4 -1
View File
@@ -45,7 +45,10 @@ Artist::getByName(Session& session, const std::string& name)
{
session.checkSharedLocked();
Wt::Dbo::collection<Artist::pointer> res = session.getDboSession().find<Artist>().where("name = ?").bind( std::string{name, 0, _maxNameLength} );
Wt::Dbo::collection<Artist::pointer> res = session.getDboSession().find<Artist>()
.where("name = ?").bind(std::string {name, 0, _maxNameLength})
.orderBy("LENGTH(mbid) DESC"); // put mbid entries first
return std::vector<Artist::pointer>(res.begin(), res.end());
}