diff --git a/database/music_database.py b/database/music_database.py index 34affa00..2db8751d 100644 --- a/database/music_database.py +++ b/database/music_database.py @@ -4888,25 +4888,27 @@ class MusicDatabase: return [] def search_artists(self, query: str, limit: int = 50, server_source: str = None) -> List[DatabaseArtist]: - """Search artists by name, optionally filtered by server source.""" + """Search artists by name, optionally filtered by server source. + Uses diacritic-insensitive matching so 'Tiesto' finds 'Tiƫsto'.""" try: conn = self._get_connection() cursor = conn.cursor() + norm_query = f"%{self._normalize_for_comparison(query)}%" if server_source: cursor.execute(""" SELECT * FROM artists - WHERE name LIKE ? AND server_source = ? + WHERE unidecode_lower(name) LIKE ? AND server_source = ? ORDER BY name LIMIT ? - """, (f"%{query}%", server_source, limit)) + """, (norm_query, server_source, limit)) else: cursor.execute(""" SELECT * FROM artists - WHERE name LIKE ? + WHERE unidecode_lower(name) LIKE ? ORDER BY name LIMIT ? - """, (f"%{query}%", limit)) + """, (norm_query, limit)) rows = cursor.fetchall()