tracker r2286 - in trunk: . src/tracker-indexer src/tracker-indexer/modules



Author: mr
Date: Wed Oct  1 10:23:43 2008
New Revision: 2286
URL: http://svn.gnome.org/viewvc/tracker?rev=2286&view=rev

Log:
	* src/tracker-indexer/modules/applications.c: Added some debugging
	to know why some .desktop files are not indexed because the module
	returns no metadata.

	* src/tracker-indexer/modules/files.c: Don't check files for to
	see if they should be excluded in this module - the daemon
	currently does this. This can still be enabled with a #define
	because this is problematic for standalone testing of the indexer
	with the -p switch. 

	* src/tracker-indexer/tracker-indexer.c: Improve the debugging so
	it doesn't look like we delete items in the database which should
	be indexed. Instead explain there is no metadata so we are
	removing the item from the database.


Modified:
   trunk/ChangeLog
   trunk/src/tracker-indexer/modules/applications.c
   trunk/src/tracker-indexer/modules/files.c
   trunk/src/tracker-indexer/tracker-indexer-module.c
   trunk/src/tracker-indexer/tracker-indexer.c

Modified: trunk/src/tracker-indexer/modules/applications.c
==============================================================================
--- trunk/src/tracker-indexer/modules/applications.c	(original)
+++ trunk/src/tracker-indexer/modules/applications.c	Wed Oct  1 10:23:43 2008
@@ -115,11 +115,13 @@
 	key_file = g_key_file_new ();
 
 	if (!g_key_file_load_from_file (key_file, file->path, G_KEY_FILE_NONE, NULL)) {
+                g_debug ("Couldn't load desktop file:'%s'", file->path);
 		g_key_file_free (key_file);
 		return NULL;
 	}
 
 	if (g_key_file_get_boolean (key_file, GROUP_DESKTOP_ENTRY, KEY_HIDDEN, NULL)) {
+                g_debug ("Desktop file is 'hidden', not gathering metadata for it");
 		g_key_file_free (key_file);
 		return NULL;
 	}
@@ -127,6 +129,7 @@
 	type = g_key_file_get_string (key_file, GROUP_DESKTOP_ENTRY, KEY_TYPE, NULL);
 
 	if (!type || g_ascii_strcasecmp (type, "Application") != 0) {
+                g_debug ("Desktop file is not of type 'Application', not gathering metadata for it");
 		g_key_file_free (key_file);
 		g_free (type);
 		return NULL;

Modified: trunk/src/tracker-indexer/modules/files.c
==============================================================================
--- trunk/src/tracker-indexer/modules/files.c	(original)
+++ trunk/src/tracker-indexer/modules/files.c	Wed Oct  1 10:23:43 2008
@@ -42,6 +42,13 @@
 #define METADATA_FILE_MODIFIED	     "File:Modified"
 #define METADATA_FILE_ACCESSED	     "File:Accessed"
 
+/* This is ONLY needed for the indexer to run standalone with
+ * the -p option, otherwise it will pick up all sorts of crap
+ * from the file system to get the metadata for. The daemon
+ * currently does all this for us.
+ */
+#undef ENABLE_FILE_EXCLUDE_CHECKING
+
 G_CONST_RETURN gchar *
 tracker_module_get_name (void)
 {
@@ -62,6 +69,8 @@
 	return service_type;
 }
 
+#ifdef ENABLE_FILE_EXCLUDE_CHECKING
+
 static gboolean
 check_exclude_file (const gchar *path)
 {
@@ -128,30 +137,28 @@
 	return FALSE;
 }
 
+#endif /* ENABLE_FILE_EXCLUDE_CHECKING */
+
 TrackerMetadata *
 tracker_module_file_get_metadata (TrackerFile *file)
 {
-	const gchar *path;
-
-	path = file->path;
-
-	if (check_exclude_file (path)) {
+#ifdef ENABLE_FILE_EXCLUDE_CHECKING
+	if (check_exclude_file (file->path)) {
 		return NULL;
 	}
+#endif /* ENABLE_FILE_EXCLUDE_CHECKING */
 
-	return tracker_metadata_utils_get_data (path);
+	return tracker_metadata_utils_get_data (file->path);
 }
 
 gchar *
 tracker_module_file_get_text (TrackerFile *file)
 {
-	const gchar *path;
-
-	path = file->path;
-
-	if (check_exclude_file (path)) {
+#ifdef ENABLE_FILE_EXCLUDE_CHECKING
+	if (check_exclude_file (file->path)) {
 		return NULL;
 	}
+#endif /* ENABLE_FILE_EXCLUDE_CHECKING */
 
-	return tracker_metadata_utils_get_text (path);
+	return tracker_metadata_utils_get_text (file->path);
 }

Modified: trunk/src/tracker-indexer/tracker-indexer-module.c
==============================================================================
--- trunk/src/tracker-indexer/tracker-indexer-module.c	(original)
+++ trunk/src/tracker-indexer/tracker-indexer-module.c	Wed Oct  1 10:23:43 2008
@@ -175,7 +175,6 @@
 
 }
 
-
 TrackerMetadata *
 tracker_indexer_module_file_get_metadata (GModule     *module,
 					  TrackerFile *file)

Modified: trunk/src/tracker-indexer/tracker-indexer.c
==============================================================================
--- trunk/src/tracker-indexer/tracker-indexer.c	(original)
+++ trunk/src/tracker-indexer/tracker-indexer.c	Wed Oct  1 10:23:43 2008
@@ -1256,11 +1256,11 @@
 }
 
 static void
-item_create_or_update (TrackerIndexer  *indexer,
-		       PathInfo        *info,
-		       const gchar     *dirname,
-		       const gchar     *basename,
-		       TrackerMetadata *metadata)
+item_add_or_update (TrackerIndexer  *indexer,
+		    PathInfo        *info,
+		    const gchar     *dirname,
+		    const gchar     *basename,
+		    TrackerMetadata *metadata)
 {
 	TrackerService *service;
 	gchar *service_type;
@@ -1287,7 +1287,9 @@
 		gchar *new_text;
 
 		/* Update case */
-		g_debug ("Updating item '%s/%s'", dirname, basename);
+		g_debug ("Updating item '%s/%s'", 
+			 dirname, 
+			 basename);
 
 		/*
 		 * Using DB directly: get old (embedded) metadata,
@@ -1311,7 +1313,9 @@
 		return;
 	}
 
-	g_debug ("Creating item '%s/%s'", dirname, basename);
+	g_debug ("Adding item '%s/%s'", 
+		 dirname, 
+		 basename);
 
 	/* Service wasn't previously indexed */
 	id = tracker_db_get_new_service_id (indexer->private->common);
@@ -1368,7 +1372,7 @@
 		return;
 	}
 
-	g_debug ("Moving file from '%s' to '%s'",
+	g_debug ("Moving item from '%s' to '%s'",
 		 info->file->path,
 		 info->other_file->path);
 
@@ -1397,7 +1401,7 @@
 }
 
 static void
-item_delete (TrackerIndexer *indexer,
+item_remove (TrackerIndexer *indexer,
 	     PathInfo	    *info,
 	     const gchar    *dirname,
 	     const gchar    *basename)
@@ -1409,7 +1413,9 @@
 
 	service_type = tracker_module_config_get_index_service (info->module_name);
 
-	g_debug ("Deleting item: '%s/%s'", dirname, basename);
+	g_debug ("Removing item: '%s/%s' (no metadata was given by module)", 
+		 dirname, 
+		 basename);
 
 	if (!service_type || !service_type[0]) {
 		gchar *name;
@@ -1974,10 +1980,10 @@
 		metadata = tracker_indexer_module_file_get_metadata (info->module, info->file);
 
 		if (metadata) {
-			item_create_or_update (indexer, info, dirname, basename, metadata);
+			item_add_or_update (indexer, info, dirname, basename, metadata);
 			tracker_metadata_free (metadata);
 		} else {
-			item_delete (indexer, info, dirname, basename);
+			item_remove (indexer, info, dirname, basename);
 		}
 	}
 



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