[tracker] TrackerMinerFS: Take into account first crawl directories when generating mtime cache.



commit 0d56d4fa0eb7ca2cbe0266ecc926abf890e0a580
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Jun 28 18:21:56 2010 +0200

    TrackerMinerFS: Take into account first crawl directories when generating mtime cache.
    
    g_file_get_parent() will return non-NULL for most of these, so 2 queries were performed
    on crawl dirs.

 src/libtracker-miner/tracker-miner-fs.c |   40 ++++++++++++------------------
 1 files changed, 16 insertions(+), 24 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index 91dd9f1..2b9eb6e 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -2377,6 +2377,7 @@ ensure_mtime_cache (TrackerMinerFS *fs,
 	 * the root directory of the file system (applies to
 	 * .gvfs mounts also!) */
 	parent = g_file_get_parent (file);
+	query = NULL;
 
 	if (fs->private->current_parent) {
 		if (parent &&
@@ -2397,30 +2398,7 @@ ensure_mtime_cache (TrackerMinerFS *fs,
 	data.main_loop = g_main_loop_new (NULL, FALSE);
 	data.values = g_hash_table_ref (fs->private->mtime_cache);
 
-	if (parent) {
-		uri = g_file_get_uri (parent);
-
-		g_debug ("Generating mtime cache for URI '%s'", uri);
-
-		query = g_strdup_printf ("SELECT ?url ?last { ?u nfo:belongsToContainer ?p ; "
-		                                                "nie:url ?url ; "
-		                                                "nfo:fileLastModified ?last . "
-		                                             "?p nie:url \"%s\" }", uri);
-
-		g_free (uri);
-
-		tracker_miner_execute_sparql (TRACKER_MINER (fs),
-		                              query,
-		                              NULL,
-		                              cache_query_cb,
-		                              &data);
-		g_free (query);
-
-		g_main_loop_run (data.main_loop);
-	}
-
-	if ((!parent || g_hash_table_size (data.values) == 0) &&
-	    file_is_crawl_directory (fs, file)) {
+	if (!parent || file_is_crawl_directory (fs, file)) {
 		/* File is a crawl directory itself, query its mtime directly */
 		uri = g_file_get_uri (file);
 
@@ -2434,7 +2412,20 @@ ensure_mtime_cache (TrackerMinerFS *fs,
 		                         "}",
 					 uri);
 		g_free (uri);
+	} else if (parent) {
+		uri = g_file_get_uri (parent);
+
+		g_debug ("Generating mtime cache for URI '%s'", uri);
 
+		query = g_strdup_printf ("SELECT ?url ?last { ?u nfo:belongsToContainer ?p ; "
+		                                                "nie:url ?url ; "
+		                                                "nfo:fileLastModified ?last . "
+		                                             "?p nie:url \"%s\" }", uri);
+
+		g_free (uri);
+	}
+
+	if (query) {
 		tracker_miner_execute_sparql (TRACKER_MINER (fs),
 		                              query,
 		                              NULL,
@@ -2442,6 +2433,7 @@ ensure_mtime_cache (TrackerMinerFS *fs,
 		                              &data);
 		g_free (query);
 
+
 		g_main_loop_run (data.main_loop);
 	}
 



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