[tracker/miner-fs-refactor: 59/101] libtracker-miner: Only spare an IRI query on updated items



commit cd2c4161826a59ee4b68475a22aef9b83d6693e0
Author: Carlos Garnacho <carlos lanedo com>
Date:   Mon Oct 3 13:47:15 2011 +0200

    libtracker-miner: Only spare an IRI query on updated items

 src/libtracker-miner/tracker-miner-fs.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index d0c80a7..f0187a3 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -1612,7 +1612,8 @@ item_add_or_update_cb (TrackerMinerFS *fs,
 static gboolean
 item_add_or_update (TrackerMinerFS *fs,
                     GFile          *file,
-                    gint            priority)
+                    gint            priority,
+                    gboolean        is_new)
 {
 	TrackerMinerFSPrivate *priv;
 	TrackerSparqlBuilder *sparql;
@@ -1630,7 +1631,10 @@ item_add_or_update (TrackerMinerFS *fs,
 	sparql = tracker_sparql_builder_new_update ();
 	g_object_ref (file);
 
-	urn = tracker_file_notifier_get_file_iri (fs->priv->file_notifier, file);
+	if (!is_new) {
+		urn = tracker_file_notifier_get_file_iri (fs->priv->file_notifier,
+		                                          file);
+	}
 
 	parent = g_file_get_parent (file);
 	parent_urn = tracker_file_notifier_get_file_iri (fs->priv->file_notifier, parent);
@@ -1974,7 +1978,9 @@ item_move (TrackerMinerFS *fs,
 			                                         G_PRIORITY_DEFAULT);
 			retval = TRUE;
 		} else {
-			retval = item_add_or_update (fs, file, G_PRIORITY_DEFAULT);
+			retval = item_add_or_update (fs, file,
+			                             G_PRIORITY_DEFAULT,
+			                             TRUE);
 		}
 
 		g_free (source_uri);
@@ -2707,7 +2713,8 @@ item_queue_handlers_cb (gpointer user_data)
 		if (!parent ||
 		    tracker_file_notifier_get_file_iri (fs->priv->file_notifier, parent) ||
 		    file_is_crawl_directory (fs, file)) {
-			keep_processing = item_add_or_update (fs, file, priority);
+			keep_processing = item_add_or_update (fs, file, priority,
+			                                      (queue == QUEUE_CREATED));
 		} else {
 			TrackerPriorityQueue *item_queue;
 			gchar *uri;



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