[tracker/tracker-3.2: 1/3] libtracker-sparql: Filter filler IDs in the query itself




commit 42a214be18110503d6f67e05515324237265b8b1
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Feb 3 18:07:01 2022 +0100

    libtracker-sparql: Filter filler IDs in the query itself
    
    We do not need extra cursor rows for the ID=0 filler arguments we
    have in the query, can just filter these out in the query.

 src/libtracker-sparql/tracker-notifier.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
---
diff --git a/src/libtracker-sparql/tracker-notifier.c b/src/libtracker-sparql/tracker-notifier.c
index cb7ce9022..7592d1bf2 100644
--- a/src/libtracker-sparql/tracker-notifier.c
+++ b/src/libtracker-sparql/tracker-notifier.c
@@ -400,7 +400,8 @@ create_extra_info_query (TrackerNotifier           *notifier,
 
        g_string_append (sparql,
                         "  } ."
-                        "  BIND (tracker:uri(xsd:integer(?id)) AS ?uri)"
+                        "  BIND (tracker:uri(xsd:integer(?id)) AS ?uri) ."
+                        "  FILTER (?id > 0) ."
                         "} ");
 
        if (service)
@@ -473,9 +474,6 @@ handle_cursor (GTask        *task,
         */
        while (tracker_sparql_cursor_next (cursor, NULL, NULL)) {
                id = tracker_sparql_cursor_get_integer (cursor, 0);
-               if (id == 0)
-                       continue;
-
                event = g_sequence_get (iter);
                iter = g_sequence_iter_next (iter);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]