[tracker/rss-enclosures] libtracker-miner: Revert deletion of original resource on update



commit 0cbd31191b558822b5df506b39ad57db123016cd
Author: Jürg Billeter <j bitron ch>
Date:   Wed Jun 9 16:14:57 2010 +0200

    libtracker-miner: Revert deletion of original resource on update
    
    This reverts commit cb0c4c59e60294a455be8f4263dc1fafdc27527c. The real
    bug was in IRI cache invalidation, which is now fixed. File update
    should not trigger a complete resource deletion, it should only delete
    embedded metadata.

 src/libtracker-miner/tracker-miner-fs.c |   33 ++++++++++--------------------
 1 files changed, 11 insertions(+), 22 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index 86a644c..9269f1f 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -64,7 +64,6 @@ typedef struct {
 	gchar *parent_urn;
 	GCancellable *cancellable;
 	TrackerSparqlBuilder *builder;
-	gboolean update;
 } ProcessData;
 
 typedef struct {
@@ -562,11 +561,10 @@ tracker_miner_fs_init (TrackerMinerFS *object)
 
 static ProcessData *
 process_data_new (GFile                *file,
-                  const gchar          *urn,
-                  const gchar          *parent_urn,
+		  const gchar          *urn,
+		  const gchar          *parent_urn,
                   GCancellable         *cancellable,
-                  TrackerSparqlBuilder *builder,
-                  gboolean              update)
+                  TrackerSparqlBuilder *builder)
 {
 	ProcessData *data;
 
@@ -574,7 +572,6 @@ process_data_new (GFile                *file,
 	data->file = g_object_ref (file);
 	data->urn = g_strdup (urn);
 	data->parent_urn = g_strdup (parent_urn);
-	data->update = update;
 
 	if (cancellable) {
 		data->cancellable = g_object_ref (cancellable);
@@ -1365,13 +1362,8 @@ item_add_or_update_cb (TrackerMinerFS *fs,
 
 		g_debug ("Adding item '%s'", uri);
 
-		if (data->update) {
-			full_sparql = g_strdup_printf ("DELETE { ?res a rdfs:Resource } WHERE { ?res nie:url \"%s\" } %s",
-			                               uri, tracker_sparql_builder_get_result (data->builder));
-		} else {
-			full_sparql = g_strdup_printf ("DROP GRAPH <%s> %s",
-			                               uri, tracker_sparql_builder_get_result (data->builder));
-		}
+		full_sparql = g_strdup_printf ("DROP GRAPH <%s> %s",
+		                               uri, tracker_sparql_builder_get_result (data->builder));
 
 		tracker_miner_execute_batch_update (TRACKER_MINER (fs),
 		                                    full_sparql,
@@ -1386,8 +1378,7 @@ item_add_or_update_cb (TrackerMinerFS *fs,
 
 static gboolean
 item_add_or_update (TrackerMinerFS *fs,
-                    GFile          *file,
-                    gboolean        update)
+                    GFile          *file)
 {
 	TrackerMinerFSPrivate *priv;
 	TrackerSparqlBuilder *sparql;
@@ -1436,7 +1427,7 @@ item_add_or_update (TrackerMinerFS *fs,
 
 	urn = iri_cache_lookup (fs, file);
 
-	data = process_data_new (file, urn, parent_urn, cancellable, sparql, update);
+	data = process_data_new (file, urn, parent_urn, cancellable, sparql);
 	priv->processing_pool = g_list_prepend (priv->processing_pool, data);
 
 	if (do_process_file (fs, data)) {
@@ -1505,7 +1496,7 @@ item_remove (TrackerMinerFS *fs,
 	                        "}",
 	                        uri);
 
-	data = process_data_new (file, NULL, NULL, NULL, NULL, FALSE);
+	data = process_data_new (file, NULL, NULL, NULL, NULL);
 	fs->private->processing_pool = g_list_prepend (fs->private->processing_pool, data);
 
 	tracker_miner_execute_batch_update (TRACKER_MINER (fs),
@@ -1750,7 +1741,7 @@ item_move (TrackerMinerFS *fs,
 			tracker_miner_fs_directory_add_internal (fs, file);
 			retval = TRUE;
 		} else {
-			retval = item_add_or_update (fs, file, FALSE);
+			retval = item_add_or_update (fs, file);
 		}
 
 		g_free (source_uri);
@@ -1815,7 +1806,7 @@ item_move (TrackerMinerFS *fs,
 
 	g_main_loop_unref (move_data.main_loop);
 
-	data = process_data_new (file, NULL, NULL, NULL, NULL, FALSE);
+	data = process_data_new (file, NULL, NULL, NULL, NULL);
 	fs->private->processing_pool = g_list_prepend (fs->private->processing_pool, data);
 
 	tracker_miner_execute_batch_update (TRACKER_MINER (fs),
@@ -2154,10 +2145,8 @@ item_queue_handlers_cb (gpointer user_data)
 		keep_processing = item_remove (fs, file);
 		break;
 	case QUEUE_CREATED:
-		keep_processing = item_add_or_update (fs, file, FALSE);
-		break;
 	case QUEUE_UPDATED:
-		keep_processing = item_add_or_update (fs, file, TRUE);
+		keep_processing = item_add_or_update (fs, file);
 		break;
 	case QUEUE_IGNORE_NEXT_UPDATE:
 		keep_processing = item_ignore_next_update (fs, file, source_file);



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