[gnome-music/wip/mschraal/search-cleanups: 3/8] grltrackerwrapper: Limit search results
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/mschraal/search-cleanups: 3/8] grltrackerwrapper: Limit search results
- Date: Sun, 28 Jul 2019 11:10:55 +0000 (UTC)
commit 0caa9e6fcca363bfc7159b77378f533d2c0d3965
Author: Marinus Schraal <mschraal gnome org>
Date: Fri Jul 19 14:25:03 2019 +0200
grltrackerwrapper: Limit search results
Limit search results, so {List,Flow}Box do not get too slow.
gnomemusic/grilowrappers/grltrackerwrapper.py | 8 ++++++++
1 file changed, 8 insertions(+)
---
diff --git a/gnomemusic/grilowrappers/grltrackerwrapper.py b/gnomemusic/grilowrappers/grltrackerwrapper.py
index 3d4e4ce0..5b06d463 100644
--- a/gnomemusic/grilowrappers/grltrackerwrapper.py
+++ b/gnomemusic/grilowrappers/grltrackerwrapper.py
@@ -618,6 +618,11 @@ class GrlTrackerWrapper(GObject.GObject):
self._source.query(query, self.METADATA_KEYS, options, callback)
def search(self, text):
+ # FIXME: Searches are limited to not bog down the UI with
+ # widget creation ({List,Flow}Box limitations). The limit is
+ # arbitrarily set to 50 and set in the Tracker query. It should
+ # be possible to set it through Grilo options instead. This
+ # does not work as expected and needs further investigation.
term = Tracker.sparql_escape_string(
GLib.utf8_normalize(
GLib.utf8_casefold(text, -1), -1, GLib.NormalizeMode.NFKD))
@@ -652,6 +657,7 @@ class GrlTrackerWrapper(GObject.GObject):
)
%(location_filter)s
}
+ LIMIT 50
""".replace('\n', ' ').strip() % {
'location_filter': self._location_filter(),
'name': term
@@ -707,6 +713,7 @@ class GrlTrackerWrapper(GObject.GObject):
)
%(location_filter)s
}
+ LIMIT 50
""".replace('\n', ' ').strip() % {
'location_filter': self._location_filter(),
'name': term
@@ -764,6 +771,7 @@ class GrlTrackerWrapper(GObject.GObject):
)
%(location_filter)s
}
+ LIMIT 50
""".replace('\n', ' ').strip() % {
'location_filter': self._location_filter(),
'name': term
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]