diff --git a/openlp/plugins/songs/lib/__init__.py b/openlp/plugins/songs/lib/__init__.py index ca811a9fd..69e491a20 100644 --- a/openlp/plugins/songs/lib/__init__.py +++ b/openlp/plugins/songs/lib/__init__.py @@ -262,8 +262,8 @@ def clean_song(manager, song): song.alternate_title = u'' song.alternate_title = song.alternate_title.strip() whitespace = re.compile(r'\W+', re.UNICODE) - song.search_title = (whitespace.sub(u' ', song.title.lower()) + u'@' + - whitespace.sub(u' ', song.alternate_title.lower())).strip() + song.search_title = (whitespace.sub(u' ', song.title).strip() + u'@' + + whitespace.sub(u' ', song.alternate_title).strip()).strip().lower() # Remove the "language" attribute from lyrics tag. This is not very # important, but this keeps the database clean. This can be removed # when everybody has cleaned his songs. diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index d693f5058..862754886 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -423,7 +423,7 @@ class SongMediaItem(MediaManagerItem): # should work for songs without alternate title. search_results = self.parent.manager.get_all_objects(Song, Song.search_title == (re.compile(r'\W+', re.UNICODE).sub(u' ', - item.data_string[u'title'].strip()) + u'@'), + item.data_string[u'title'].strip()) + u'@').strip().lower(), Song.search_title.asc()) else: search_results = self.parent.manager.get_all_objects(Song,