[gnome-music] query: Quote column names in fts:match clauses
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music] query: Quote column names in fts:match clauses
- Date: Wed, 2 Nov 2016 12:20:25 +0000 (UTC)
commit 15c9ead1d3bf1ce9f6464684c82f4bc6e8f63b16
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Nov 2 08:46:52 2016 +0100
query: Quote column names in fts:match clauses
The colon in the column name seems able to confuse the FTS parser, let's
help it better by enclosing the column name with double quotes, which is
valid syntax according to the FTS5 syntax reference.
https://bugzilla.gnome.org/show_bug.cgi?id=766505
gnomemusic/query.py | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/gnomemusic/query.py b/gnomemusic/query.py
index 086ce21..a660ee0 100644
--- a/gnomemusic/query.py
+++ b/gnomemusic/query.py
@@ -852,21 +852,21 @@ class Query():
@staticmethod
def get_albums_with_artist_match(name):
name = Tracker.sparql_escape_string(name)
- query = """?performer fts:match "nmm:artistName: %(name)s*" . """.replace('\n', ' ').strip() %
{'name': name}
+ query = """?performer fts:match '"nmm:artistName" : %(name)s*' . """.replace('\n', ' ').strip() %
{'name': name}
return Query.albums(query)
@staticmethod
def get_albums_with_album_match(name):
name = Tracker.sparql_escape_string(name)
- query = """?album fts:match "nie:title: %(name)s*" . """.replace('\n', ' ').strip() % {'name': name}
+ query = """?album fts:match '"nie:title" : %(name)s*' . """.replace('\n', ' ').strip() % {'name':
name}
return Query.albums(query)
@staticmethod
def get_albums_with_track_match(name):
name = Tracker.sparql_escape_string(name)
- query = """?song fts:match "nie:title: %(name)s*" . """.replace('\n', ' ').strip() % {'name': name}
+ query = """?song fts:match '"nie:title" : %(name)s*' . """.replace('\n', ' ').strip() % {'name':
name}
return Query.albums(query)
@@ -899,21 +899,21 @@ class Query():
@staticmethod
def get_artists_with_artist_match(name):
name = Tracker.sparql_escape_string(name)
- query = """?performer fts:match "nmm:artistName: %(name)s*" . """.replace('\n', ' ').strip() %
{'name': name}
+ query = """?performer fts:match '"nmm:artistName" : %(name)s*' . """.replace('\n', ' ').strip() %
{'name': name}
return Query.artists(query)
@staticmethod
def get_artists_with_album_match(name):
name = Tracker.sparql_escape_string(name)
- query = """?album fts:match "nie:title: %(name)s*" . """.replace('\n', ' ').strip() % {'name': name}
+ query = """?album fts:match '"nie:title" : %(name)s*' . """.replace('\n', ' ').strip() % {'name':
name}
return Query.artists(query)
@staticmethod
def get_artists_with_track_match(name):
name = Tracker.sparql_escape_string(name)
- query = """?song fts:match "nie:title: %(name)s*" . """.replace('\n', ' ').strip() % {'name': name}
+ query = """?song fts:match '"nie:title" : %(name)s*' . """.replace('\n', ' ').strip() % {'name':
name}
return Query.artists(query)
@@ -946,21 +946,21 @@ class Query():
@staticmethod
def get_songs_with_artist_match(name):
name = Tracker.sparql_escape_string(name)
- query = """?performer fts:match "nmm:artistName: %(name)s*" . """.replace('\n', ' ').strip() %
{'name': name}
+ query = """?performer fts:match '"nmm:artistName" : %(name)s*' . """.replace('\n', ' ').strip() %
{'name': name}
return Query.songs(query)
@staticmethod
def get_songs_with_album_match(name):
name = Tracker.sparql_escape_string(name)
- query = """?album fts:match "nie:title: %(name)s*" . """.replace('\n', ' ').strip() % {'name': name}
+ query = """?album fts:match '"nie:title" : %(name)s*' . """.replace('\n', ' ').strip() % {'name':
name}
return Query.songs(query)
@staticmethod
def get_songs_with_track_match(name):
name = Tracker.sparql_escape_string(name)
- query = """?song fts:match "nie:title: %(name)s*" . """.replace('\n', ' ').strip() % {'name': name}
+ query = """?song fts:match '"nie:title" : %(name)s*' . """.replace('\n', ' ').strip() % {'name':
name}
return Query.songs(query)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]