[tracker-miners/wip/carlosg/volume-indexing-fixes: 2/2] tracker-miner-fs: Cast xsd:dateTime for comparisons




commit 866b7b1971763fd4d644ad8cbbda9f4ab042190f
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Aug 16 00:49:50 2020 +0200

    tracker-miner-fs: Cast xsd:dateTime for comparisons
    
    Otherwise we resort to string comparison, which doesn't yield the
    expected results. Also ensure to use the tracker:FileSystem graph
    where appropriate.

 src/miners/fs/tracker-miner-files.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/src/miners/fs/tracker-miner-files.c b/src/miners/fs/tracker-miner-files.c
index 145997c7c..1769af6cb 100644
--- a/src/miners/fs/tracker-miner-files.c
+++ b/src/miners/fs/tracker-miner-files.c
@@ -2816,20 +2816,24 @@ miner_files_in_removable_media_remove_by_date (TrackerMinerFiles  *miner,
         * which was last unmounted before the given date */
        g_string_append_printf (queries,
                                "DELETE { "
-                               "  ?f a rdfs:Resource . "
+                               "  GRAPH " DEFAULT_GRAPH " {"
+                               "    ?f a rdfs:Resource . "
+                               "  }"
                                "  GRAPH ?g {"
                                "    ?ie a rdfs:Resource "
                                "  }"
                                "} WHERE { "
-                               "  ?v a tracker:IndexedFolder ; "
-                               "     tracker:isRemovable true ; "
-                               "     tracker:available false ; "
-                               "     tracker:unmountDate ?d . "
-                               "  ?f nie:dataSource ?v . "
+                               "  GRAPH " DEFAULT_GRAPH " {"
+                               "    ?v a tracker:IndexedFolder ; "
+                               "       tracker:isRemovable true ; "
+                               "       tracker:available false ; "
+                               "       tracker:unmountDate ?d . "
+                               "    ?f nie:dataSource ?v . "
+                               "    FILTER ( ?d < \"%s\"^^xsd:dateTime) "
+                               "  }"
                                "  GRAPH ?g {"
                                "    ?ie nie:isStoredAs ?f "
                                "  }"
-                               "  FILTER ( ?d < \"%s\") "
                                "}",
                                date);
 


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