From 3b6ba36e83254c6bcb205c5ef6c8f930b1f1eb23 Mon Sep 17 00:00:00 2001 From: Anton Romanov Date: Tue, 6 Dec 2016 17:24:35 -0800 Subject: [PATCH] =?UTF-8?q?Streamline=20special=20char=20filtering=20out?= =?UTF-8?q?=20and=20add=20=C2=B4=20to=20that=20list?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/libtomahawk/Query.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/libtomahawk/Query.cpp b/src/libtomahawk/Query.cpp index 8a10f553b..1a6312a19 100644 --- a/src/libtomahawk/Query.cpp +++ b/src/libtomahawk/Query.cpp @@ -685,10 +685,12 @@ Query::howSimilar( const Tomahawk::result_ptr& r ) qTrackname = queryTrack()->trackSortname(); } + static const QRegExp filterOutChars = QRegExp(QString::fromUtf8("[-`´~!@#$%^&*()_—+=|:;<>«»,.?/{}\'\"\\[\\]\\\\]")); + //Cleanup symbols for minor naming differences - qArtistname.remove(QRegExp(QString::fromUtf8("[-`~!@#$%^&*()_—+=|:;<>«»,.?/{}\'\"\\[\\]\\\\]"))); - qTrackname.remove(QRegExp(QString::fromUtf8("[-`~!@#$%^&*()_—+=|:;<>«»,.?/{}\'\"\\[\\]\\\\]"))); - qAlbumname.remove(QRegExp(QString::fromUtf8("[-`~!@#$%^&*()_—+=|:;<>«»,.?/{}\'\"\\[\\]\\\\]"))); + qArtistname.remove(filterOutChars); + qTrackname.remove(filterOutChars); + qAlbumname.remove(filterOutChars); // normal edit distance const int artdist = TomahawkUtils::levenshtein( qArtistname, rArtistname );