[tracker/tracker-0.10] tracker-miner-fs: Unset nie:url to set our own on file updates.



commit d1692f2ff8a47868efa50523c059f21e629b301e
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Jun 8 17:48:35 2011 +0200

    tracker-miner-fs: Unset nie:url to set our own on file updates.
    
    This is so tracker-miner-fs can check it in order to know whether the
    file is known to tracker or not.

 src/libtracker-miner/tracker-miner-fs.c |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index f476965..d2ae82e 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -1724,8 +1724,13 @@ item_add_or_update_cb (TrackerMinerFS        *fs,
 		if (!attribute_update_only) {
 			gchar *full_sparql;
 
-			/* update, delete all statements inserted by miner
-			 * except for rdf:type statements as they could cause implicit deletion of user data */
+			/* Update, delete all statements inserted by miner except:
+			 *  - rdf:type statements as they could cause implicit deletion of user data
+			 *  - nie:contentCreated so it persists across updates
+			 *
+			 * Additionally, delete also nie:url as it might have been set by 3rd parties,
+			 * and it's used to know whether a file is known to tracker or not.
+			 */
 			full_sparql = g_strdup_printf ("DELETE {"
 			                               "  GRAPH <%s> {"
 			                               "    <%s> ?p ?o"
@@ -1737,11 +1742,15 @@ item_add_or_update_cb (TrackerMinerFS        *fs,
 			                               "    FILTER (?p != rdf:type && ?p != nie:contentCreated)"
 			                               "  } "
 			                               "} "
+						       "DELETE {"
+						       "  <%s> nie:url ?o"
+						       "} WHERE {"
+						       "  <%s> nie:url ?o"
+						       "}"
 			                               "%s",
-			                               TRACKER_MINER_FS_GRAPH_URN,
-			                               ctxt->urn,
-			                               TRACKER_MINER_FS_GRAPH_URN,
-			                               ctxt->urn,
+			                               TRACKER_MINER_FS_GRAPH_URN, ctxt->urn,
+			                               TRACKER_MINER_FS_GRAPH_URN, ctxt->urn,
+						       ctxt->urn, ctxt->urn,
 			                               tracker_sparql_builder_get_result (ctxt->builder));
 
 			/* Note that set_sparql_string() takes ownership of the passed string */



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