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




commit 200dd09cc95f877688191872ea777b93a0ef85f7
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 949eda0f7..6bc21f309 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]