tracker r1889 - in branches/indexer-split: . src/libtracker-db src/tracker-indexer



Author: ifrade
Date: Fri Jul 18 13:07:46 2008
New Revision: 1889
URL: http://svn.gnome.org/viewvc/tracker?rev=1889&view=rev

Log:
Disabled xesam to set correct service type to the files

Modified:
   branches/indexer-split/ChangeLog
   branches/indexer-split/src/libtracker-db/tracker-db-manager.c
   branches/indexer-split/src/tracker-indexer/tracker-indexer.c

Modified: branches/indexer-split/src/libtracker-db/tracker-db-manager.c
==============================================================================
--- branches/indexer-split/src/libtracker-db/tracker-db-manager.c	(original)
+++ branches/indexer-split/src/libtracker-db/tracker-db-manager.c	Fri Jul 18 13:07:46 2008
@@ -1648,13 +1648,16 @@
 			TrackerField  *def;
 
 			def = db_row_to_field_def (result_set);
-
-			g_message ("Loading xesam metadata def:'%s' with type:%d",
-				   tracker_field_get_name (def),
-				   tracker_field_get_data_type (def));
-
-			tracker_ontology_add_field (def);
-
+			/*
+			 * The ids in xesam db overwritte the IDs in common db! It means that all the 
+			 * files are assigned to a wrong category
+			 *
+			 * g_message ("Loading xesam metadata def:'%s' with type:%d",
+			 *                 tracker_field_get_name (def),
+			 *                 tracker_field_get_data_type (def));
+			 *
+			 * tracker_ontology_add_field (def);
+			 */
 			valid = tracker_db_result_set_iter_next (result_set);
 		}
 
@@ -1687,16 +1690,19 @@
 
                         mimes = db_get_xesam_mimes_for_service_id (iface, id);
                         mime_prefixes = db_get_xesam_mime_prefixes_for_service_id (iface, id);
-
-                        g_message ("Adding xesam service:'%s' with id:%d and mimes:%d",
-				   name,
-				   id,
-				   g_slist_length (mimes));
-
-                        tracker_ontology_add_service_type (service,
-							   mimes,
-							   mime_prefixes);
-
+			
+			/* 
+			 * Same as above
+			 *
+			 * g_message ("Adding xesam service:'%s' with id:%d and mimes:%d",
+			 *   name,
+			 *   id,
+			 *   g_slist_length (mimes));
+			 *
+			 * tracker_ontology_add_service_type (service,
+			 *				   mimes,
+			 *				   mime_prefixes);
+			 */
                         g_slist_free (mimes);
                         g_slist_free (mime_prefixes);
                         g_object_unref (service);

Modified: branches/indexer-split/src/tracker-indexer/tracker-indexer.c
==============================================================================
--- branches/indexer-split/src/tracker-indexer/tracker-indexer.c	(original)
+++ branches/indexer-split/src/tracker-indexer/tracker-indexer.c	Fri Jul 18 13:07:46 2008
@@ -790,20 +790,24 @@
 	metadata = tracker_indexer_module_file_get_metadata (info->module, info->file);
 
 	if (metadata) {
-		TrackerService *service;
-		const gchar *service_type;
+		TrackerService *service_def;
+		gchar *service_type, *mimetype;
 		gboolean created;
 		guint32 id;
 
-		service_type = tracker_indexer_module_get_name (info->module);
-		service = tracker_ontology_get_service_type_by_name (service_type);
+		mimetype = tracker_file_get_mime_type (info->file->path);
+		service_type = tracker_ontology_get_service_type_for_mime (mimetype);
+		service_def = tracker_ontology_get_service_type_by_name (service_type);
 		id = tracker_db_get_new_service_id (indexer->private->common);
 
 		created = tracker_db_create_service (indexer->private->metadata, 
 						     id, 
-						     service, 
+						     service_def, 
 						     info->file->path, 
 						     metadata);
+
+		g_free (service_type);
+		g_free (mimetype);
 		
 		if (created) {
 			gchar *text;
@@ -820,9 +824,9 @@
 				inc_events = TRUE;
 			}
 
-			tracker_db_increment_stats (indexer->private->common, service);
+			tracker_db_increment_stats (indexer->private->common, service_def);
 
-			index_metadata (indexer, id, service, metadata);
+			index_metadata (indexer, id, service_def, metadata);
 
 			text = tracker_indexer_module_file_get_text (info->module, info->file);
 



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