[tracker/tracker-0.8] TrackerMinerFS: Take into account first crawl directories when generating mtime cache.
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/tracker-0.8] TrackerMinerFS: Take into account first crawl directories when generating mtime cache.
- Date: Thu, 1 Jul 2010 16:39:14 +0000 (UTC)
commit 7987d233e48612e8f30dc79cc7e0aee705d6bca1
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 911676b..49e8515 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -2342,6 +2342,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 &&
@@ -2362,30 +2363,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);
@@ -2399,7 +2377,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,
@@ -2407,6 +2398,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]