[tracker/extraction-improvements: 1/5] tracker-miner-fs: Revert commit 3dd75bacc30



commit ecf61db1bc3e491e8c6bddb3a3bad9ce107517e2
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri May 6 12:26:05 2011 +0200

    tracker-miner-fs: Revert commit 3dd75bacc30
    
    Minimal sparql insertion is going to be handled from
    TrackerMinerFiles instead.

 src/libtracker-miner/tracker-miner-fs.c |  120 ++++++++++++++-----------------
 src/miners/fs/tracker-miner-files.c     |    3 -
 2 files changed, 55 insertions(+), 68 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index bffbe79..5d6c631 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -1673,81 +1673,71 @@ item_add_or_update_cb (TrackerMinerFS        *fs,
 			ctxt->builder = tracker_sparql_builder_new_update ();
 
 			do_process_file (fs, task);
-			g_free (uri);
-
-			return;
-
 		} else {
+			g_message ("Could not process '%s': %s", uri, error->message);
+
 			fs->private->total_files_notified_error++;
-			g_message ("Could not process '%s': %s",
-			            uri,
-			            error->message ? error->message : "No error given");
-		}
-	}
 
-	if (ctxt->urn) {
-		gboolean attribute_update_only;
+			tracker_processing_pool_remove_task (fs->private->processing_pool, task);
+			tracker_processing_task_free (task);
 
-		attribute_update_only = GPOINTER_TO_INT (g_object_steal_qdata (G_OBJECT (task_file),
-		                                                               fs->private->quark_attribute_updated));
-		g_debug ("Updating item%s%s%s '%s' with urn '%s'%s",
-		         error != NULL ? " (which had extractor error '" : "",
-		         error != NULL ? (error->message ? error->message : "No error given") : "",
-		         error != NULL ? "')" : "",
-		         uri,
-		         ctxt->urn,
-		         attribute_update_only ? " (attributes only)" : "");
-
-		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 */
-			full_sparql = g_strdup_printf ("DELETE {"
-			                               "  GRAPH <%s> {"
-			                               "    <%s> ?p ?o"
-			                               "  } "
-			                               "} "
-			                               "WHERE {"
-			                               "  GRAPH <%s> {"
-			                               "    <%s> ?p ?o"
-			                               "    FILTER (?p != rdf:type && ?p != nie:contentCreated)"
-			                               "  } "
-			                               "} "
-			                               "%s",
-			                               TRACKER_MINER_FS_GRAPH_URN,
-			                               ctxt->urn,
-			                               TRACKER_MINER_FS_GRAPH_URN,
-			                               ctxt->urn,
-			                               tracker_sparql_builder_get_result (ctxt->builder));
-
-			/* Note that set_sparql_string() takes ownership of the passed string */
-			tracker_processing_task_set_sparql_string (task, full_sparql);
-		} else {
-			/* Do not drop graph if only updating attributes, the SPARQL builder
-			 * will already contain the necessary DELETE statements for the properties
-			 * being updated */
-			tracker_processing_task_set_sparql (task, ctxt->builder);
+			item_queue_handlers_set_up (fs);
 		}
 	} else {
-		if (error != NULL) {
-			g_debug ("Creating minimal info for new item '%s' which had error: '%s'",
+		if (ctxt->urn) {
+			gboolean attribute_update_only;
+
+			attribute_update_only = GPOINTER_TO_INT (g_object_steal_qdata (G_OBJECT (task_file),
+			                                                               fs->private->quark_attribute_updated));
+			g_debug ("Updating item '%s' with urn '%s'%s",
 			         uri,
-			         error->message ? error->message : "No error given");
+			         ctxt->urn,
+			         attribute_update_only ? " (attributes only)" : "");
+
+			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 */
+				full_sparql = g_strdup_printf ("DELETE {"
+				                               "  GRAPH <%s> {"
+				                               "    <%s> ?p ?o"
+				                               "  } "
+				                               "} "
+				                               "WHERE {"
+				                               "  GRAPH <%s> {"
+				                               "    <%s> ?p ?o"
+				                               "    FILTER (?p != rdf:type && ?p != nie:contentCreated)"
+				                               "  } "
+				                               "} "
+				                               "%s",
+				                               TRACKER_MINER_FS_GRAPH_URN,
+				                               ctxt->urn,
+				                               TRACKER_MINER_FS_GRAPH_URN,
+				                               ctxt->urn,
+				                               tracker_sparql_builder_get_result (ctxt->builder));
+
+				/* Note that set_sparql_string() takes ownership of the passed string */
+				tracker_processing_task_set_sparql_string (task, full_sparql);
+			} else {
+				/* Do not drop graph if only updating attributes, the SPARQL builder
+				 * will already contain the necessary DELETE statements for the properties
+				 * being updated */
+				tracker_processing_task_set_sparql (task, ctxt->builder);
+			}
 		} else {
 			g_debug ("Creating new item '%s'", uri);
+			tracker_processing_task_set_sparql (task, ctxt->builder);
 		}
 
-		tracker_processing_task_set_sparql (task, ctxt->builder);
-	}
-
-	/* If push_ready_task() returns FALSE, it means the actual db update was delayed,
-	 * and in this case we need to setup queue handlers again */
-	if (!tracker_processing_pool_push_ready_task (fs->private->processing_pool,
-	                                              task,
-	                                              processing_pool_task_finished_cb,
-	                                              fs)) {
-		item_queue_handlers_set_up (fs);
+		/* If push_ready_task() returns FALSE, it means the actual db update was delayed,
+		 * and in this case we need to setup queue handlers again */
+		if (!tracker_processing_pool_push_ready_task (fs->private->processing_pool,
+		                                              task,
+		                                              processing_pool_task_finished_cb,
+		                                              fs)) {
+			item_queue_handlers_set_up (fs);
+		}
 	}
 
 	g_free (uri);
diff --git a/src/miners/fs/tracker-miner-files.c b/src/miners/fs/tracker-miner-files.c
index a77b5c8..f1a1205 100644
--- a/src/miners/fs/tracker-miner-files.c
+++ b/src/miners/fs/tracker-miner-files.c
@@ -1959,9 +1959,6 @@ extractor_get_embedded_metadata_cb (const gchar *preupdate,
 	const gchar *uuid;
 
 	if (error) {
-		tracker_sparql_builder_graph_close (data->sparql);
-		tracker_sparql_builder_insert_close (data->sparql);
-
 		/* Something bad happened, notify about the error */
 		tracker_miner_fs_file_notify (TRACKER_MINER_FS (data->miner), data->file, error);
 		process_file_data_free (data);



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