tracker r1658 - in branches/indexer-split: . data data/services src/libtracker-common src/libtracker-db src/trackerd tests tests/trackerd



Author: pvanhoof
Date: Thu Jun 12 13:27:46 2008
New Revision: 1658
URL: http://svn.gnome.org/viewvc/tracker?rev=1658&view=rev

Log:
2008-06-12  Philip Van Hoof  <pvanhoof gnome org>

	* svn merge -r 1538:1656 ../xesam-support
 
2008-06-12  Philip Van Hoof  <pvanhoof gnome org>

	* tests/trackerd/tracker-xesam-test.c:
	* tests/trackerd/Makefile.am:
	* tests/Makefile.am:
	* configure.ac:

	Added unit test infrastructure for Xesam



Added:
   branches/indexer-split/src/libtracker-common/tracker-xesam-field.c
      - copied unchanged from r1656, /branches/xesam-support/src/libtracker-common/tracker-xesam-field.c
   branches/indexer-split/src/libtracker-common/tracker-xesam-field.h
      - copied unchanged from r1656, /branches/xesam-support/src/libtracker-common/tracker-xesam-field.h
   branches/indexer-split/src/libtracker-common/tracker-xesam-ontology.c
      - copied unchanged from r1656, /branches/xesam-support/src/libtracker-common/tracker-xesam-ontology.c
   branches/indexer-split/src/libtracker-common/tracker-xesam-ontology.h
      - copied unchanged from r1656, /branches/xesam-support/src/libtracker-common/tracker-xesam-ontology.h
   branches/indexer-split/tests/trackerd/
      - copied from r1656, /branches/xesam-support/tests/trackerd/
Removed:
   branches/indexer-split/src/trackerd/tracker-xesam-ontology.c
   branches/indexer-split/src/trackerd/tracker-xesam-ontology.h
Modified:
   branches/indexer-split/ChangeLog
   branches/indexer-split/configure.ac
   branches/indexer-split/data/services/xesam-metadata.mmapping
   branches/indexer-split/data/sqlite-stored-procs.sql
   branches/indexer-split/src/libtracker-common/Makefile.am
   branches/indexer-split/src/libtracker-db/tracker-db-interface-sqlite.c
   branches/indexer-split/src/libtracker-db/tracker-db-manager.c
   branches/indexer-split/src/trackerd/Makefile.am
   branches/indexer-split/src/trackerd/tracker-db.c
   branches/indexer-split/src/trackerd/tracker-db.h
   branches/indexer-split/src/trackerd/tracker-main.c
   branches/indexer-split/src/trackerd/tracker-xesam-live-search.c
   branches/indexer-split/src/trackerd/tracker-xesam-live-search.h
   branches/indexer-split/src/trackerd/tracker-xesam-manager.c
   branches/indexer-split/src/trackerd/tracker-xesam-manager.h
   branches/indexer-split/src/trackerd/tracker-xesam-query.c
   branches/indexer-split/src/trackerd/tracker-xesam-query.h
   branches/indexer-split/tests/Makefile.am

Modified: branches/indexer-split/configure.ac
==============================================================================
--- branches/indexer-split/configure.ac	(original)
+++ branches/indexer-split/configure.ac	Thu Jun 12 13:27:46 2008
@@ -238,13 +238,18 @@
    glib_pkgconfig=
 fi
 
+have_xesam_glib=no
 if test "x$enable_unit_tests" = "xyes"; then
    if test "x$have_unit_tests" != "xyes"; then
       AC_MSG_ERROR([Couldn't find unit test compatible glib.])
+   else
+	PKG_CHECK_MODULES(XESAM_GLIB, xesam-glib, [have_xesam_glib=yes], [have_xesam_glib=no])
    fi
 fi
 
 AM_CONDITIONAL(HAVE_UNIT_TESTS, test "x$have_unit_tests" = "xyes")
+AM_CONDITIONAL(HAVE_XESAM_GLIB, test "x$have_xesam_glib" = "xyes")
+
 
 ####################################################################
 # External QDBM check
@@ -730,6 +735,7 @@
 	src/trackerd/Makefile
 	tests/Makefile
 	tests/libtracker-common/Makefile
+	tests/trackerd/Makefile
 	src/xdgmime/Makefile
 	po/Makefile.in
 	python/Makefile

Modified: branches/indexer-split/data/services/xesam-metadata.mmapping
==============================================================================
--- branches/indexer-split/data/services/xesam-metadata.mmapping	(original)
+++ branches/indexer-split/data/services/xesam-metadata.mmapping	Thu Jun 12 13:27:46 2008
@@ -765,7 +765,7 @@
 
 
 [xesam:url]
-MetaName=
+MetaName=File:Name
 
 
 [xesam:useCount]

Modified: branches/indexer-split/data/sqlite-stored-procs.sql
==============================================================================
--- branches/indexer-split/data/sqlite-stored-procs.sql	(original)
+++ branches/indexer-split/data/sqlite-stored-procs.sql	Thu Jun 12 13:27:46 2008
@@ -30,11 +30,11 @@
 SetEventsBeingHandled UPDATE Events SET BeingHandled = 1;
 
 GetLiveSearchAllIDs SELECT X.ServiceID FROM LiveSearches AS X WHERE X.SearchID = ?
-GetLiveSearchDeletedIDs SELECT E.ServiceID FROM Events as E, LiveSearches as X WHERE E.ServiceID = X.ServiceID AND X.SearchID = ? AND E.EventType IS 'Delete';
-DeleteLiveSearchDeletedIDs DELETE FROM LiveSearches AS Y WHERE Y.ServiceID IN SELECT ServiceID FROM Events as E, LiveSearches as X WHERE E.ServiceID = X.ServiceID AND X.SearchID = ? AND E.EventType IS 'Delete'
+GetLiveSearchDeletedIDs SELECT E.ServiceID FROM Events as E, LiveSearches as X WHERE E.ServiceID = X.ServiceID AND X.SearchID = ? AND E.EventType = 'Delete';
+DeleteLiveSearchDeletedIDs DELETE FROM LiveSearches AS Y WHERE Y.ServiceID IN SELECT ServiceID FROM Events as E, LiveSearches as X WHERE E.ServiceID = X.ServiceID AND X.SearchID = ? AND E.EventType = 'Delete'
 
 GetLiveSearchHitCount SELECT count(*) FROM LiveSearches WHERE SearchID = ?;
-LiveSearchStopSearch DELETE FROM LiveSearches as X WHERE E.SearchID = ?
+LiveSearchStopSearch DELETE FROM LiveSearches WHERE SearchID = ?
 
 GetNewEventID SELECT OptionValue FROM Options WHERE OptionKey = 'EventSequence';
 UpdateNewEventID UPDATE Options set OptionValue = ? WHERE OptionKey = 'EventSequence';
@@ -210,3 +210,5 @@
 GetXesamMetaDataChildren SELECT Child FROM XesamMetaDataChildren WHERE Parent = ?;
 GetXesamMetaDataMappings SELECT MetaName FROM XesamMetaDataMapping WHERE XesamMetaName = ?;
 GetXesamMetaDataLookups SELECT DISTINCT MetaName FROM XesamMetaDataLookup WHERE XesamMetaName = ?;
+
+GetXesamMetadataTypes SELECT ID, MetaName, DataTypeID, Parents FROM XesamMetaDataTypes;
\ No newline at end of file

Modified: branches/indexer-split/src/libtracker-common/Makefile.am
==============================================================================
--- branches/indexer-split/src/libtracker-common/Makefile.am	(original)
+++ branches/indexer-split/src/libtracker-common/Makefile.am	Thu Jun 12 13:27:46 2008
@@ -53,7 +53,11 @@
 	tracker-type-utils.c			\
 	tracker-type-utils.h			\
 	tracker-utils.c				\
-	tracker-utils.h
+	tracker-utils.h				\
+	tracker-xesam-field.c			\
+	tracker-xesam-field.h			\
+	tracker-xesam-ontology.c		\
+	tracker-xesam-ontology.h
 
 libtracker_common_la_LDFLAGS = -version-info 0:0:0
 libtracker_common_la_LIBADD = 			\

Modified: branches/indexer-split/src/libtracker-db/tracker-db-interface-sqlite.c
==============================================================================
--- branches/indexer-split/src/libtracker-db/tracker-db-interface-sqlite.c	(original)
+++ branches/indexer-split/src/libtracker-db/tracker-db-interface-sqlite.c	Thu Jun 12 13:27:46 2008
@@ -328,6 +328,13 @@
 	}
 }
 
+static void
+foreach_print_error (gpointer key, gpointer value, gpointer stmt)
+{
+	if (value == stmt)
+		g_print ("In %s\n", (char*) key);
+}
+
 static TrackerDBResultSet *
 create_result_set_from_stmt (TrackerDBInterfaceSqlite  *interface,
 			     sqlite3_stmt              *stmt,
@@ -377,6 +384,9 @@
 	}
 
 	if (result != SQLITE_DONE) {
+		
+		g_hash_table_foreach (priv->statements, foreach_print_error, stmt);
+		
 		if (result == SQLITE_CORRUPT) {
 			g_critical ("Database %s is corrupt. Can't live without it", priv->filename);
 			g_assert_not_reached ();

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	Thu Jun 12 13:27:46 2008
@@ -26,8 +26,10 @@
 #include <zlib.h>
 
 #include <libtracker-common/tracker-field.h>
+#include <libtracker-common/tracker-xesam-field.h>
 #include <libtracker-common/tracker-nfs-lock.h>
 #include <libtracker-common/tracker-ontology.h>
+#include <libtracker-common/tracker-xesam-ontology.h>
 #include <libtracker-common/tracker-type-utils.h>
 #include <libtracker-common/tracker-utils.h>
 
@@ -949,6 +951,107 @@
         return service;
 }
 
+static TrackerXesamField *
+db_row_to_xesam_field_def (TrackerDBResultSet *result_set) 
+{
+        TrackerXesamField *field_def;
+	TrackerFieldType   field_type;
+	gchar             *id_str, *name;
+	gint               id;
+
+	field_def = tracker_xesam_field_new ();
+
+	tracker_db_result_set_get (result_set,
+				   0, &id,
+				   1, &name,
+				   2, &field_type,
+				   -1);
+
+	id_str = tracker_int_to_string (id);
+
+	tracker_xesam_field_set_id (field_def, id_str);
+	tracker_xesam_field_set_name (field_def, name);
+	tracker_xesam_field_set_data_type (field_def, field_type);
+
+	g_free (id_str);
+	g_free (name);
+
+	return field_def;
+}
+
+static TrackerService *
+db_row_to_xesam_service (TrackerDBResultSet *result_set)
+{
+        TrackerService *service;
+        GSList         *new_list = NULL;
+        gint            id, i;
+	gchar          *name, *parent, *content_metadata;
+	gboolean        enabled, embedded, has_metadata, has_fulltext;
+	gboolean        has_thumbs, show_service_files, show_service_directories;
+
+        service = tracker_service_new ();
+
+	tracker_db_result_set_get (result_set,
+				   0, &id,
+				   1, &name,
+				   2, &parent,
+				   3, &enabled,
+				   4, &embedded,
+				   5, &has_metadata,
+				   6, &has_fulltext,
+				   7, &has_thumbs,
+				   8, &content_metadata,
+				   10, &show_service_files,
+				   11, &show_service_directories,
+				   -1);
+
+        tracker_service_set_id (service, id);
+        tracker_service_set_name (service, name);
+        tracker_service_set_parent (service, parent);
+        tracker_service_set_enabled (service, enabled);
+        tracker_service_set_embedded (service, embedded);
+        tracker_service_set_has_metadata (service, has_metadata);
+        tracker_service_set_has_full_text (service, has_fulltext);
+        tracker_service_set_has_thumbs (service, has_thumbs);
+	tracker_service_set_content_metadata (service, content_metadata);
+
+        tracker_service_set_show_service_files (service, show_service_files);
+        tracker_service_set_show_service_directories (service, show_service_directories);
+
+        for (i = 12; i < 23; i++) {
+		gchar *metadata;
+
+		tracker_db_result_set_get (result_set, i, &metadata, -1);
+
+		if (metadata) {
+			new_list = g_slist_prepend (new_list, metadata);
+		}
+        }
+
+	/* FIXME: is this necessary? */
+#if 0
+        /* Hack to prevent db change late in the cycle, check the
+         * service name matches "Applications", then add some voodoo.
+         */
+        if (strcmp (name, "Applications") == 0) {
+                /* These strings should be definitions at the top of
+                 * this file somewhere really.
+                 */
+                new_list = g_slist_prepend (new_list, g_strdup ("App:DisplayName"));
+                new_list = g_slist_prepend (new_list, g_strdup ("App:Exec"));
+                new_list = g_slist_prepend (new_list, g_strdup ("App:Icon"));
+        }
+#endif
+
+        new_list = g_slist_reverse (new_list);
+
+        tracker_service_set_key_metadata (service, new_list);
+	g_slist_foreach (new_list, (GFunc) g_free, NULL);
+        g_slist_free (new_list);
+
+        return service;
+}
+
 static GSList *
 db_mime_query (TrackerDBInterface *iface,
 	       const gchar        *stored_proc,
@@ -1501,6 +1604,84 @@
 	}
 }
 
+static void
+db_get_static_xesam_data (TrackerDBInterface *iface)
+{
+	TrackerDBResultSet *result_set;
+
+	/* Get static xesam metadata info */
+	result_set = tracker_db_interface_execute_procedure (iface, 
+							     NULL, 
+							     "GetXesamMetadataTypes", 
+							     NULL);
+
+	if (result_set) {
+		gboolean valid = TRUE;
+
+		while (valid) {
+			TrackerXesamField  *def;
+
+			def = db_row_to_xesam_field_def (result_set);
+
+			g_message ("Loading xesam metadata def:'%s' with type:%d",
+				   tracker_xesam_field_get_name (def),
+				   tracker_xesam_field_get_data_type (def));
+
+			tracker_xesam_ontology_add_field (def);
+
+			valid = tracker_db_result_set_iter_next (result_set);
+		}
+
+		g_object_unref (result_set);
+	}
+
+	/* Get static xesam service info */
+	result_set = tracker_db_interface_execute_procedure (iface,
+							     NULL, 
+							     "GetAllServices", 
+							     NULL);
+
+	if (result_set) {
+		gboolean valid = TRUE;
+
+		while (valid) {
+			TrackerService *service;
+			GSList         *mimes, *mime_prefixes;
+			const gchar    *name;
+			gint            id;
+
+                        service = db_row_to_service (result_set);
+
+                        if (!service) {
+                                continue;
+			}
+
+                        id = tracker_service_get_id (service);
+                        name = tracker_service_get_name (service);
+
+                        mimes = db_get_mimes_for_service_id (iface, id);
+                        mime_prefixes = db_get_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_xesam_ontology_add_service_type (service,
+								 mimes,
+								 mime_prefixes);
+
+                        g_slist_free (mimes);
+                        g_slist_free (mime_prefixes);
+                        g_object_unref (service);
+
+			valid = tracker_db_result_set_iter_next (result_set);
+		}
+
+		g_object_unref (result_set);
+	}
+}
+
 static const gchar *
 db_type_to_string (TrackerDB db)
 {
@@ -1924,6 +2105,25 @@
 		db_xesam_create_lookup (iface);
 	}
 
+	db_exec_no_reply (iface,
+			  "ATTACH '%s' as 'file-meta'",
+			  tracker_db_manager_get_file (TRACKER_DB_FILE_METADATA));
+
+	db_exec_no_reply (iface,
+			  "ATTACH '%s' as 'email-meta'",
+			  tracker_db_manager_get_file (TRACKER_DB_EMAIL_METADATA));
+
+	db_exec_no_reply (iface,
+			  "ATTACH '%s' as 'common'",
+			  tracker_db_manager_get_file (TRACKER_DB_COMMON));
+
+	db_exec_no_reply (iface,
+			  "ATTACH '%s' as 'cache'",
+			  tracker_db_manager_get_file (TRACKER_DB_CACHE));
+
+	/* Load static xesam data */
+	db_get_static_xesam_data (iface);
+
 	return iface;
 }
 

Modified: branches/indexer-split/src/trackerd/Makefile.am
==============================================================================
--- branches/indexer-split/src/trackerd/Makefile.am	(original)
+++ branches/indexer-split/src/trackerd/Makefile.am	Thu Jun 12 13:27:46 2008
@@ -95,8 +95,6 @@
 	tracker-utils.h							\
 	tracker-xesam.c							\
 	tracker-xesam.h							\
-	tracker-xesam-ontology.c					\
-	tracker-xesam-ontology.h					\
 	tracker-xesam-manager.c						\
 	tracker-xesam-manager.h						\
 	tracker-xesam-query.c						\

Modified: branches/indexer-split/src/trackerd/tracker-db.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-db.c	(original)
+++ branches/indexer-split/src/trackerd/tracker-db.c	Thu Jun 12 13:27:46 2008
@@ -1955,9 +1955,9 @@
 	if (!def) {
 		return;
 	}
-	
+
 	if (!tracker_field_get_embedded (def) && 
-            tracker_ontology_service_type_has_embedded (service)) {
+	     tracker_ontology_service_type_has_embedded (service)) {
 		backup_delete_non_embedded_metadata (iface,
 						     id, 
 						     tracker_field_get_id (def));
@@ -1987,7 +1987,7 @@
 					  "update Services set KeyMetadata%d = NULL where id = %s",
 					  key_field, id);
 	}
-		
+
 	/* Perform deletion */
 	switch (tracker_field_get_data_type (def)) {
 	case TRACKER_FIELD_TYPE_INDEX:
@@ -2034,7 +2034,7 @@
 		break;
 	}
 
-	
+
 	/* Update fulltext index differentially with old values and NULL */
 	if (update_index && old_value) {
 		update_metadata_index (id, service, def, old_value, " ");
@@ -2212,7 +2212,7 @@
 				  query_joins,                               /*        B2 */
 				  where_query ? where_query : "WHERE",       /*        B3 */
 				  where_query ? "AND " : "");                /*        B3 */
-	
+
 	return result_set;
 }
 
@@ -2249,17 +2249,155 @@
 	return result_set;
 }
 
+/* FIXME This function should be moved with other help-functions somewhere. 
+ * It is used by xesam_live_search parsing. */
+
+static GList *
+add_metadata_field (TrackerDBInterface *iface,
+		    GSList **fields, 
+		    const char *xesam_name)
+{
+	TrackerDBResultSet *result_set;
+	TrackerFieldData   *field_data;
+	gboolean            field_exists;
+	const GSList       *l;
+	GList              *reply;
+	gboolean            valid;
+
+	reply = NULL;
+	field_exists = FALSE;
+	field_data = NULL;
+	valid = TRUE;
+
+	/* Do the xesam mapping */
+
+	g_debug ("add metadata field");
+
+	result_set = tracker_db_exec_proc (iface, "GetXesamMetaDataMappings",xesam_name, NULL);
+
+	if (!result_set) {
+		return NULL;
+	}
+
+	while (valid) {
+		gchar *field_name;
+
+		tracker_db_result_set_get (result_set, 0, &field_name, -1);
+
+		/* Check if field is already in list */
+		for (l = *fields; l; l = l->next) {
+			const gchar *this_field_name;
+			
+			this_field_name = tracker_field_data_get_field_name (l->data);
+			
+			if (!this_field_name) {
+				continue;
+			}
+
+			if (strcasecmp (this_field_name, field_name) != 0) {
+				continue;
+			}
+
+			field_exists = TRUE;
+
+			break;
+		}
+		
+		if (!field_exists) {
+			field_data = tracker_db_get_metadata_field (iface, 
+								    "Files", 
+								    field_name, 
+								    g_slist_length (*fields),
+								    FALSE, 
+								    FALSE);
+
+			if (field_data) {
+				*fields = g_slist_prepend (*fields, field_data);
+			} 
+		} 
+		
+		reply = g_list_append (reply, field_data);
+		valid = tracker_db_result_set_iter_next (result_set);
+		g_free (field_name);
+	}
+	
+	return reply;
+}
+
+
+
 TrackerDBResultSet *
 tracker_db_live_search_get_hit_data (TrackerDBInterface *iface, 
-				     const gchar        *search_id)
+				     const gchar        *search_id,
+				     GStrv               field_names)
 {
+	TrackerDBResultSet *result;
+	GSList             *fields = NULL;
+	GSList             *l = NULL;
+	GString            *sql_select;
+	GString            *sql_join;
+	gint                i = 0;
+
 	g_return_val_if_fail (TRACKER_IS_DB_INTERFACE (iface), NULL);
 	g_return_val_if_fail (search_id != NULL, NULL);
 
-	return tracker_db_exec (iface, 
-				"SELECT * FROM LiveSearches as X "
-				"WHERE X.SearchID = '%s'", 
-				search_id);
+	sql_select = g_string_new ("X.ServiceID, ");
+	sql_join = g_string_new ("");
+
+	while (field_names[i]) {
+		GList *field_data_list = NULL;
+
+		field_data_list = add_metadata_field (iface, 
+						      &fields, 
+						      field_names[i]);
+
+		if (!field_data_list) {
+			g_warning ("Asking for a non-mapped xesam field: %s", field_names[i]);
+			g_string_free (sql_select, TRUE);
+			g_string_free (sql_join, TRUE);
+			return NULL;
+		}
+		
+		if (i) {
+			g_string_append_printf (sql_select, ",");
+		}
+
+		g_string_append_printf (sql_select, " %s", 
+					tracker_field_data_get_select_field (field_data_list->data) );
+		
+		i++;
+	}
+
+	for (l = fields; l; l = l->next) {
+		gchar *field_name;
+
+		field_name = tracker_db_metadata_get_related_names (iface, 
+								    tracker_field_data_get_field_name (l->data));
+		g_string_append_printf (sql_join, 
+					"INNER JOIN %s %s ON (X.ServiceID = %s.ServiceID AND %s.MetaDataID in (%s))\n ",
+					tracker_field_data_get_table_name (l->data),
+					tracker_field_data_get_alias (l->data),
+					tracker_field_data_get_alias (l->data),
+					tracker_field_data_get_alias (l->data),
+					field_name);
+		g_free (field_name);
+	}
+
+	g_debug("Query : SELECT %s FROM LiveSearches as X \n"
+		"%s"
+		"WHERE X.SearchID = '%s'", 
+		sql_select->str, sql_join->str, search_id); 
+
+	result = tracker_db_exec (iface, 
+				  "SELECT %s FROM LiveSearches as X \n"
+				  "%s"
+				  "WHERE X.SearchID = '%s'", 
+				  sql_select->str, sql_join->str, search_id);
+
+	g_string_free (sql_select, TRUE);
+	g_string_free (sql_join, TRUE);
+
+	return result;
 }
 
 void 

Modified: branches/indexer-split/src/trackerd/tracker-db.h
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-db.h	(original)
+++ branches/indexer-split/src/trackerd/tracker-db.h	Thu Jun 12 13:27:46 2008
@@ -218,7 +218,8 @@
 TrackerDBResultSet *tracker_db_live_search_get_deleted_ids     (TrackerDBInterface  *iface,
 								const gchar         *search_id);
 TrackerDBResultSet *tracker_db_live_search_get_hit_data        (TrackerDBInterface  *iface,
-								const gchar         *search_id);
+								const gchar         *search_id,
+								GStrv                fields);
 TrackerDBResultSet *tracker_db_live_search_get_hit_count       (TrackerDBInterface  *iface,
 								const gchar         *search_id);
 

Modified: branches/indexer-split/src/trackerd/tracker-main.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-main.c	(original)
+++ branches/indexer-split/src/trackerd/tracker-main.c	Thu Jun 12 13:27:46 2008
@@ -686,7 +686,7 @@
 	tracker_crawler_start (tracker->crawler);
 	
 	proxy = tracker_dbus_indexer_get_proxy ();
-	tracker_xesam_subscribe_indexer_updated (proxy);
+	tracker_xesam_subscribe_index_updated (proxy);
 
 	return FALSE;
 }
@@ -826,6 +826,7 @@
 
 	tracker_nfs_lock_init (tracker_config_get_nfs_locking (tracker->config));
 	tracker_ontology_init ();
+	tracker_xesam_ontology_init ();
 	tracker_db_init ();
 	tracker_db_manager_init (TRUE, data_dir, user_data_dir, sys_tmp_dir); /* Using TRUE=broken */
 	tracker_xesam_manager_init ();

Modified: branches/indexer-split/src/trackerd/tracker-xesam-live-search.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-xesam-live-search.c	(original)
+++ branches/indexer-split/src/trackerd/tracker-xesam-live-search.c	Thu Jun 12 13:27:46 2008
@@ -24,6 +24,8 @@
 #include <dbus/dbus-glib-bindings.h>
 
 #include "tracker-xesam-live-search.h"
+#include <libtracker-common/tracker-xesam-field.h>
+#include <libtracker-common/tracker-xesam-ontology.h>
 #include "tracker-xesam.h"
 #include "tracker-xesam-manager.h"
 #include "tracker-xesam-query.h"
@@ -270,6 +272,7 @@
 /* Created and Modified items */
 static void
 get_hits_added_modified (TrackerXesamLiveSearch  *self, 
+			 MatchWithEventsFlags     flags,
 			 TrackerDBInterface      *iface, 
 			 GArray                 **added, 
 			 GArray                 **modified) 
@@ -279,19 +282,23 @@
 	GArray             *m_modified = NULL;
 	TrackerDBResultSet *result_set;
 
+	/* Right now we are ignoring flags (both creates and updates are 
+	 * searched) */
+
 	result_set = tracker_db_live_search_get_new_ids (iface, 
 							 tracker_xesam_live_search_get_id (self),
 							 tracker_xesam_live_search_get_from_query (self),
 							 tracker_xesam_live_search_get_join_query (self),
 							 tracker_xesam_live_search_get_where_query (self)); /* Query */
 
-	if (!result_set)
+	if (!result_set) {
 		return;
+	}
 
 	while (ls_valid) {
-		GValue ls_value = { 0, };
-		GValue ev_type = { 0, };
-		gint ls_i_value;
+		GValue       ls_value = { 0, };
+		GValue       ev_type = { 0, };
+		gint         ls_i_value;
 		const gchar *str;
 
 		_tracker_db_result_set_get_value (result_set, 0, &ls_value);
@@ -303,7 +310,7 @@
 
 		if (!strcmp (str, "Update")) {
 			gboolean noadd = FALSE;
-			guint i;
+			guint    i;
 
 			if (m_modified == NULL) {
 				m_modified = g_array_new (FALSE, TRUE, sizeof (guint32));
@@ -376,6 +383,7 @@
 	g_object_unref (result_set);
 }
 
+
 /**
  * tracker_xesam_live_search_match_with_events:
  * @self: A #TrackerXesamLiveSearch
@@ -386,14 +394,14 @@
  * Find all items that match with the current events for @self.
  **/
 void
-tracker_xesam_live_search_match_with_events (TrackerXesamLiveSearch  *self, 
+tracker_xesam_live_search_match_with_events (TrackerXesamLiveSearch  *self,
+					     MatchWithEventsFlags     flags,
 					     GArray                 **added, 
 					     GArray                 **removed, 
 					     GArray                 **modified)
 {
 	TrackerDBInterface *iface;
 	TrackerDBResultSet *result_set;
-	GObject            *xesam;
 
 	g_return_if_fail (TRACKER_IS_XESAM_LIVE_SEARCH (self));
 	g_return_if_fail (added != NULL);
@@ -401,49 +409,53 @@
 	g_return_if_fail (modified != NULL);
 
 	iface = tracker_db_manager_get_db_interface (TRACKER_DB_XESAM);
-	xesam = tracker_dbus_get_object (TRACKER_TYPE_XESAM);
 
 	*added = NULL;
 	*removed = NULL;
 	*modified = NULL;
 
-	/* Deleted items */
-	result_set = tracker_db_live_search_get_deleted_ids (iface, 
-							     tracker_xesam_live_search_get_id (self));
-
-	if (result_set) {
-		gboolean valid;
-
-		valid = TRUE;
-
-		while (valid) {
-			GValue ls_value = { 0, };
-			gint   ls_i_value;
+	if (flags & MATCH_WITH_EVENTS_DELETES) {
+		/* Deleted items */
+		result_set = tracker_db_live_search_get_deleted_ids (iface, 
+								     tracker_xesam_live_search_get_id (self));
+
+		if (result_set) {
+			gboolean valid;
+
+			valid = TRUE;
+
+			while (valid) {
+				GValue ls_value = { 0, };
+				gint   ls_i_value;
 			
-			_tracker_db_result_set_get_value (result_set, 
-							  0, 
-							  &ls_value);
-			ls_i_value = g_value_get_int (&ls_value);
+				_tracker_db_result_set_get_value (result_set, 
+								  0, 
+								  &ls_value);
+				ls_i_value = g_value_get_int (&ls_value);
 			
-			if (*removed == NULL) {
-				*removed = g_array_new (FALSE, 
-							TRUE, 
-							sizeof (guint32));
-			}
+				if (*removed == NULL) {
+					*removed = g_array_new (FALSE, 
+								TRUE, 
+								sizeof (guint32));
+				}
 
-			g_array_append_val (*removed, ls_i_value);
-			g_value_unset (&ls_value);
+				g_array_append_val (*removed, ls_i_value);
+				g_value_unset (&ls_value);
 			
-			valid = tracker_db_result_set_iter_next (result_set);
+				valid = tracker_db_result_set_iter_next (result_set);
+			}
+		
+			g_object_unref (result_set);
 		}
-
-		g_object_unref (result_set);
 	}
 
-	/* Created and Modified items */
-	get_hits_added_modified (self, iface, added, modified);
+	if (flags & MATCH_WITH_EVENTS_CREATES || flags & MATCH_WITH_EVENTS_MODIFIES) {
+		/* Created and Modified items */
+		get_hits_added_modified (self, flags, iface, added, modified);
+	}
 }
 
+
 /**
  * tracker_xesam_live_search_close:
  * @self: a #TrackerXesamLiveSearch
@@ -468,10 +480,8 @@
 			     "Search was already closed");
 	} else {
 		TrackerDBInterface *iface;
-		GObject            *xesam;
 		
 		iface = tracker_db_manager_get_db_interface (TRACKER_DB_XESAM);
-		xesam = tracker_dbus_get_object (TRACKER_TYPE_XESAM);
 
 		tracker_db_live_search_stop (iface, 
 					     tracker_xesam_live_search_get_id (self));
@@ -513,10 +523,8 @@
 		TrackerDBInterface *iface;
 		TrackerDBResultSet *result_set;
 		GValue              value = {0, };
-		GObject            *xesam;
 
 		iface = tracker_db_manager_get_db_interface (TRACKER_DB_XESAM);
-		xesam = tracker_dbus_get_object (TRACKER_TYPE_XESAM);
 
 		result_set = tracker_db_live_search_get_hit_count (iface, 
 								   tracker_xesam_live_search_get_id (self));
@@ -527,6 +535,64 @@
 	}
 }
 
+
+typedef struct {
+	gint key;
+	gpointer value;
+} OneRow;
+
+static inline gpointer 
+rows_lookup (GPtrArray *rows, gint key)
+{
+	guint    i;
+	gpointer value = NULL;
+
+	for (i = 0; i < rows->len; i++) {
+		OneRow *row = g_ptr_array_index (rows, i);
+		if (row->key == key) {
+			value = row->value;
+			break;
+		}
+	}
+
+	return value;
+}
+
+static inline void
+rows_destroy (GPtrArray *rows)
+{
+	guint i;
+
+	for (i = 0; i < rows->len; i++) {
+		g_slice_free (OneRow, g_ptr_array_index (rows, i));
+	}
+
+	g_ptr_array_free (rows, TRUE);
+}
+
+static inline void
+rows_insert (GPtrArray *rows, gint key, gpointer value)
+{
+	OneRow *row = g_slice_new (OneRow);
+
+	row->key = key;
+	row->value = value;
+
+	g_ptr_array_add (rows, row);
+}
+
+static inline void 
+rows_migrate (GPtrArray *rows, GPtrArray *result)
+{
+	guint i;
+
+	for (i = 0; i < rows->len; i++) {
+		OneRow *one = g_ptr_array_index (rows, i);
+		GPtrArray *row = one->value;
+		g_ptr_array_add (result, row);
+	}
+}
+
 /**
  * Retrieving Hits
  * The return value of GetHits and GetHitData is a sorted array of hits. A hit 
@@ -552,50 +618,227 @@
 static void
 get_hit_data (TrackerXesamLiveSearch  *self, 
 	      TrackerDBResultSet      *result_set,
-	      GPtrArray              **hit_data)
+	      GPtrArray              **hit_data,
+	      GStrv                    fields)
 {
-	GPtrArray *result;
-	gboolean   valid = TRUE;
-	gint       hitfields_columns = 0;
-	gint       column;
+	GPtrArray  *result = g_ptr_array_new ();
+	GPtrArray  *rows = g_ptr_array_new ();
+	gboolean    valid = TRUE;
+	guint       field_count;
 
-	result = g_ptr_array_new ();
+	field_count = g_strv_length (fields);
 
 	while (valid) {
-		GPtrArray *row;
+		guint                  column;
+		GPtrArray             *row;
+		GValue                 value_in = {0, };
+		gboolean               insert = FALSE;
+		gint                   key;
+		TrackerXesamFieldType  data_type;
+		TrackerXesamField     *field_def;
+
+		_tracker_db_result_set_get_value (result_set, 0, &value_in);
+
+		/* key must be the first column, as an int, unique per row that
+		 * must actually be returned. Example:
+		 * 
+		 * 1, a, b, c, 1
+		 * 1, a, b, c, 2
+		 * 1, a, b, c, 3
+		 * 1, a, b, c, 4
+		 * 2, a, b, c, 1
+		 * 3, a, b, c, 1
+		 * 4, a, b, c, 2
+		 * 5, a, b, c, 2
+		 * 
+		 * for:
+		 * 
+		 * [
+		 *    [a, b, c, [1, 2, 3, 4]]
+		 *    [a, b, c, [1]]
+		 *    [a, b, c, [1]]
+		 *    [a, b, c, [2]]
+		 *    [a, b, c, [2]]
+		 * ]
+		 **/
+
+		key = g_value_get_int (&value_in);
+
+		/* Think before rewriting this using a GHashTable: A GHashTable
+		 * doesn't preserve the sort order. The sort order is indeed
+		 * significant for the Xesam spec. */
+
+		row = rows_lookup (rows, key);
+
+		if (!row) {
+			row = g_ptr_array_new ();
+			insert = TRUE;
+		}
+
+		for (column = 1; column < field_count + 1; column++) {
+			GValue cur_value = {0, };
+
+			_tracker_db_result_set_get_value (result_set, 
+							  column, 
+							  &cur_value);
 
-		row = g_ptr_array_new ();
+			field_def = tracker_xesam_ontology_get_field_def (fields[column-1]);
+			data_type = tracker_xesam_field_get_data_type (field_def);
+
+			switch (data_type) {
+				case TRACKER_XESAM_FIELD_TYPE_LIST_OF_URLS:
+				case TRACKER_XESAM_FIELD_TYPE_LIST_OF_URIS:
+				case TRACKER_XESAM_FIELD_TYPE_LIST_OF_DATETIMES:
+				case TRACKER_XESAM_FIELD_TYPE_LIST_OF_STRINGS: {
+					GValue    *variant;
+					GPtrArray *my_array;
+
+					if (row->len <= (unsigned int) column) {
+						variant = g_new0 (GValue, 1);
+						g_value_init (variant, 
+							      dbus_g_type_get_collection ("GPtrArray", 
+										     G_TYPE_STRING));
+
+						my_array = g_ptr_array_new ();
+						g_value_set_boxed_take_ownership (variant, 
+										  my_array);
+
+						g_ptr_array_add (row, variant);
+
+					} else {
+						variant = g_ptr_array_index (row, column);
+						my_array = g_value_get_boxed (variant);
+					}
+
+					g_ptr_array_add  (my_array, 
+							       g_value_dup_string (&cur_value));
+
+				}
+				break;
+
+				case TRACKER_XESAM_FIELD_TYPE_LIST_OF_FLOATS: {
+					GValue   *variant;
+					GArray   *my_array;
+					gfloat    float_val;
+
+					if (row->len <= (unsigned int) column) {
+						variant = g_new0 (GValue, 1);
+						g_value_init (variant, 
+							      dbus_g_type_get_collection ("GArray", 
+										     G_TYPE_FLOAT));
+
+						my_array = g_array_new (FALSE, 
+									 TRUE, 
+									 sizeof (gfloat));
+						g_value_set_boxed_take_ownership (variant, my_array);
+
+						g_ptr_array_add (row, variant);
+					} else {
+						variant = g_ptr_array_index (row, column);
+						my_array = g_value_get_boxed (variant);
+					}
 
-		for (column = 0; column < hitfields_columns; column++) {
-			GValue *value;
-			GValue  value_in = {0, };
+					float_val = g_value_get_float (&cur_value);
+					g_array_append_val (my_array, float_val);
+				}
+				break;
+
+				case TRACKER_XESAM_FIELD_TYPE_LIST_OF_INTEGERS: {
+					GValue *variant;
+					GArray *my_array;
+					gint    int_val;
+
+					if (row->len <= (unsigned int) column) {
+						variant = g_new0 (GValue, 1);
+						g_value_init (variant, 
+							      dbus_g_type_get_collection ("GArray", 
+										     G_TYPE_INT));
+
+						my_array = g_array_new (FALSE, 
+									 TRUE, 
+									 sizeof (gint));
+						g_value_set_boxed_take_ownership (variant, my_array);
+
+						g_ptr_array_add (row, variant);
+					} else {
+						variant = g_ptr_array_index (row, column);
+						my_array = g_value_get_boxed (variant);
+					}
 
-			value = g_new0 (GValue, 1);
+					int_val = g_value_get_int (&cur_value);
+					g_array_append_val (my_array, int_val);
+				}
+				break;
+
+				case TRACKER_XESAM_FIELD_TYPE_LIST_OF_BOOLEANS: {
+					GValue  *variant;
+					GArray  *my_array;
+					gboolean bool_val;
+
+					if (row->len <= (unsigned int) column) {
+						variant = g_new0 (GValue, 1);
+						g_value_init (variant, 
+							      dbus_g_type_get_collection ("GArray", 
+										     G_TYPE_BOOLEAN));
+
+						my_array = g_array_new (FALSE, 
+									 TRUE, 
+									 sizeof (gboolean));
+						g_value_set_boxed_take_ownership (variant, my_array);
+
+						g_ptr_array_add (row, variant);
+					} else {
+						variant = g_ptr_array_index (row, column);
+						my_array = g_value_get_boxed (variant);
+					}
 
-			/* Question for ottela: how will we do list-values like
-			 * xesam:userKeywords? That's a column with comma's? or
-			 * how is this done? An extra result_set to loop? An
-			 * extra query? A union?
-			 */
+					bool_val = g_value_get_boolean (&cur_value);
+					g_array_append_val (my_array, bool_val);
+				}
+				break;
+
+				case TRACKER_XESAM_FIELD_TYPE_STRING:
+				case TRACKER_XESAM_FIELD_TYPE_FLOAT:
+				case TRACKER_XESAM_FIELD_TYPE_INTEGER:
+				case TRACKER_XESAM_FIELD_TYPE_BOOLEAN:
+				case TRACKER_XESAM_FIELD_TYPE_DATE:
+				default: {
+					if (insert) {
+						GValue *value = g_new0 (GValue, 1);
 
-			_tracker_db_result_set_get_value (result_set, column, &value_in);
+						g_value_init (value, 
+							      G_VALUE_TYPE (&cur_value));
 
-			g_value_init (value, G_VALUE_TYPE (&value_in));
-			g_value_copy (&value_in, value);
+						g_value_copy (&cur_value, value);
+						g_ptr_array_add (row, value);
+					}
 
-			g_value_unset (&value_in);
+					/* Else it's a redundant cell (a previous 
+					 * loop-cycle has added this item to the
+					 * final to-return result already, using
+					 * the top-row). */
 
-			g_ptr_array_add (row, value);
+				}
+				break;
+			}
+			g_value_unset (&cur_value);
 		}
 
-		g_ptr_array_add (result, row);
+
+		if (insert) {
+			rows_insert (rows, key, row);
+		}
 
 		valid = tracker_db_result_set_iter_next (result_set);
 	}
 
+	rows_migrate (rows, result);
+	rows_destroy (rows);
+
 	*hit_data = result;
 }
 
+
 /**
  * tracker_xesam_live_search_get_hits:
  * @self: a #TrackerXesamLiveSearch
@@ -621,6 +864,8 @@
 	g_return_if_fail (TRACKER_IS_XESAM_LIVE_SEARCH (self));
 	g_return_if_fail (hits != NULL);
 
+	g_debug ("Get_hits called");
+
 	priv = self->priv;
 
 	if (!priv->active)
@@ -628,21 +873,51 @@
 				TRACKER_XESAM_ERROR_SEARCH_NOT_ACTIVE,
 				"Search is not active");
 	else {
-		TrackerDBInterface *iface;
-		TrackerDBResultSet *result_set;
-		GObject            *xesam;
-		
-		iface = tracker_db_manager_get_db_interface (TRACKER_DB_XESAM);
-		xesam = tracker_dbus_get_object (TRACKER_TYPE_XESAM);
+		TrackerXesamSession *session;
+		GValue              *value;
+		GError              *tmp_error = NULL;
+
+		session = priv->session;
+
+		tracker_xesam_session_get_property (session, 
+						    "hit.fields", 
+						    &value, 
+						    &tmp_error);
+
+		if (tmp_error) {
+			g_propagate_error(error, tmp_error);
+			return;
+		}
 
-		/* For ottela: fetch results for get_hits */
+		if (value) {
+			TrackerDBInterface  *iface;
+			TrackerDBResultSet  *result_set;
+			GStrv                fields;
 
-		result_set = tracker_db_live_search_get_hit_data (iface,
-								  tracker_xesam_live_search_get_id (self));
+			fields = g_value_get_boxed (value);
 
-		if (result_set) {
-			get_hit_data (self, result_set, hits);
-			g_object_unref (result_set);
+			iface = tracker_db_manager_get_db_interface (TRACKER_DB_XESAM);
+
+			/* For ottela: fetch results for get_hits */
+
+			result_set = tracker_db_live_search_get_hit_data (iface,
+									  tracker_xesam_live_search_get_id (self),
+									  fields);
+
+			if (result_set) {
+
+				get_hit_data (self, 
+					      result_set, 
+					      hits,
+					      fields);
+
+				g_object_unref (result_set);
+			} else {
+				*hits =  g_ptr_array_new ();
+			}
+
+			g_value_unset (value);
+			g_free (value);
 		}
 	}
 }
@@ -667,21 +942,49 @@
 			     TRACKER_XESAM_ERROR_SEARCH_NOT_ACTIVE,
 			     "Search is not active");
 	} else {
-		TrackerDBInterface *iface;
-		TrackerDBResultSet *result_set;
-		GObject            *xesam;
-		
+		TrackerXesamSession *session = priv->session;
+		TrackerDBInterface  *iface;
+		TrackerDBResultSet  *result_set;
+		GValue              *value;
+		GError              *tmp_error = NULL;
+
 		iface = tracker_db_manager_get_db_interface (TRACKER_DB_XESAM);
-		xesam = tracker_dbus_get_object (TRACKER_TYPE_XESAM);
 
-		/* For ottela: fetch results for get_hits */
+		g_debug ("live_search_get_range_hits");
 
-		result_set = tracker_db_live_search_get_hit_data (iface,
-								  tracker_xesam_live_search_get_id (self));
+		tracker_xesam_session_get_property (session, 
+						    "hit.fields", 
+						    &value, 
+						    &tmp_error);
+
+		if (tmp_error) {
+			g_propagate_error(error, tmp_error);
+			return;
+		}
 
-		if (result_set) {
-			get_hit_data (self, result_set, hits);
-			g_object_unref (result_set);
+		if (value) {
+			GStrv fields;
+
+			fields = g_value_get_boxed (value);
+
+			result_set = tracker_db_live_search_get_hit_data (iface,
+									  tracker_xesam_live_search_get_id (self),
+									  fields);
+					
+			if (result_set) {
+
+				get_hit_data (self, 
+					      result_set, 
+					      hits,
+					      fields);
+
+				g_object_unref (result_set);
+			} else {
+				*hits = g_ptr_array_new ();
+			}
+
+			g_value_unset (value);
+			g_free (value);
 		}
 	}
 }
@@ -736,19 +1039,23 @@
 	} else {
 		TrackerDBInterface *iface;
 		TrackerDBResultSet *result_set;
-		GObject            *xesam;
-		
-		iface = tracker_db_manager_get_db_interface (TRACKER_DB_XESAM);
-		xesam = tracker_dbus_get_object (TRACKER_TYPE_XESAM);
 
-		/* For ottela: fetch results for get_hits */
+		iface = tracker_db_manager_get_db_interface (TRACKER_DB_XESAM);
 
 		result_set = tracker_db_live_search_get_hit_data (iface,
-								  tracker_xesam_live_search_get_id (self));
+								  tracker_xesam_live_search_get_id (self),
+								  fields);
 
 		if (result_set) {
-			get_hit_data (self, result_set, hit_data);
+
+			get_hit_data (self, 
+				      result_set, 
+				      hit_data,
+				      fields);
+
 			g_object_unref (result_set);
+		} else {
+			*hit_data = g_ptr_array_new ();
 		}
 	}
 }
@@ -777,19 +1084,23 @@
 	} else {
 		TrackerDBInterface *iface;
 		TrackerDBResultSet *result_set;
-		GObject            *xesam;
 
 		iface = tracker_db_manager_get_db_interface (TRACKER_DB_XESAM);
-		xesam = tracker_dbus_get_object (TRACKER_TYPE_XESAM);
-		
-		/* For ottela: fetch results for get_hits */
 
 		result_set = tracker_db_live_search_get_hit_data (iface,
-								  tracker_xesam_live_search_get_id (self));
+								  tracker_xesam_live_search_get_id (self),
+								  fields);
 
 		if (result_set) {
-			get_hit_data (self, result_set, hit_data);
+
+			get_hit_data (self, 
+				      result_set, 
+				      hit_data,
+				      fields);
+
 			g_object_unref (result_set);
+		} else {
+			*hit_data = g_ptr_array_new ();
 		}
 	}
 }
@@ -834,11 +1145,11 @@
 				"Search is closed");
 	else {
 		TrackerDBInterface *iface;
-		GObject            *xesam; 
 		GArray             *hits;
 
+		g_debug ("* * * Activate");
+
 		iface = tracker_db_manager_get_db_interface (TRACKER_DB_XESAM);
-		xesam = tracker_dbus_get_object (TRACKER_TYPE_XESAM);;
 
 		tracker_db_live_search_start (iface,
 					      tracker_xesam_live_search_get_from_query (self),
@@ -856,6 +1167,12 @@
 		if (hits) {
 			g_array_free (hits, TRUE);
 		}
+
+		g_timeout_add_full (G_PRIORITY_DEFAULT,
+				    100, 
+				    (GSourceFunc) tracker_xesam_live_search_emit_done, 
+				    g_object_ref (self),
+				    (GDestroyNotify) g_object_unref);
 	}
 
 	priv->active = TRUE;
@@ -997,8 +1314,9 @@
 		g_free (orig_where);
 	}
 
-	g_message ("Parsed to '%s' and '%s'", 
-		   priv->from_sql, 
+	g_message ("Parsed to '%s', '%s' and '%s'", 
+		   priv->from_sql,
+		   priv->join_sql,
 		   priv->where_sql);
 
 	return TRUE;

Modified: branches/indexer-split/src/trackerd/tracker-xesam-live-search.h
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-xesam-live-search.h	(original)
+++ branches/indexer-split/src/trackerd/tracker-xesam-live-search.h	Thu Jun 12 13:27:46 2008
@@ -1,6 +1,7 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 /*
  * Copyright (C) 2008, Nokia
+ * Authors: Philip Van Hoof (pvanhoof gnome org)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public
@@ -39,6 +40,14 @@
 typedef struct _TrackerXesamLiveSearchClass TrackerXesamLiveSearchClass;
 typedef struct _TrackerXesamLiveSearchPriv TrackerXesamLiveSearchPriv;
 
+typedef enum {
+	MATCH_WITH_EVENTS_CREATES = 1<<0,
+	MATCH_WITH_EVENTS_DELETES = 1<<1,
+	MATCH_WITH_EVENTS_MODIFIES = 1<<2
+} MatchWithEventsFlags;
+
+#define MATCH_WITH_EVENTS_ALL_FLAGS (MATCH_WITH_EVENTS_CREATES|MATCH_WITH_EVENTS_DELETES|MATCH_WITH_EVENTS_MODIFIES)
+
 struct _TrackerXesamLiveSearch {
 	GObject parent_instance;
 	TrackerXesamLiveSearchPriv * priv;
@@ -101,6 +110,7 @@
 							   GArray                  *hit_ids);
 void         tracker_xesam_live_search_emit_done          (TrackerXesamLiveSearch  *self);
 void         tracker_xesam_live_search_match_with_events  (TrackerXesamLiveSearch  *self, 
+							   MatchWithEventsFlags     flags,
 							   GArray                 **added, 
 							   GArray                 **removed, 
 							   GArray                 **modified);

Modified: branches/indexer-split/src/trackerd/tracker-xesam-manager.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-xesam-manager.c	(original)
+++ branches/indexer-split/src/trackerd/tracker-xesam-manager.c	Thu Jun 12 13:27:46 2008
@@ -79,7 +79,7 @@
 }
 
 void 
-tracker_xesam_subscribe_indexer_updated (DBusGProxy *proxy) 
+tracker_xesam_subscribe_index_updated (DBusGProxy *proxy) 
 {
 	dbus_g_proxy_add_signal (proxy, "Finished",
 			   G_TYPE_INVALID,
@@ -252,7 +252,6 @@
 	GList              *sessions;
 	gboolean            reason_to_live = FALSE;
 
-
 	iface = tracker_db_manager_get_db_interface (TRACKER_DB_XESAM);
 	g_return_val_if_fail (iface != NULL, FALSE);
 
@@ -276,7 +275,13 @@
 				 tracker_xesam_live_search_get_id (searches->data));
 
 			search = searches->data;
-			tracker_xesam_live_search_match_with_events (search, 
+
+			/* TODO: optimize by specifying what exactly got changed
+			 * during this event ping in the MatchWithEventsFlags 
+			 being passed (second parameter) */
+
+			tracker_xesam_live_search_match_with_events (search,
+								     MATCH_WITH_EVENTS_ALL_FLAGS,
 								     &added, 
 								     &removed, 
 								     &modified);

Modified: branches/indexer-split/src/trackerd/tracker-xesam-manager.h
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-xesam-manager.h	(original)
+++ branches/indexer-split/src/trackerd/tracker-xesam-manager.h	Thu Jun 12 13:27:46 2008
@@ -63,7 +63,7 @@
 						       GError                 **error);
 gchar *  tracker_xesam_manager_generate_unique_key    (void);
 gboolean tracker_xesam_manager_is_uri_in_xesam_dir    (const gchar             *uri);
-void     tracker_xesam_subscribe_indexer_updated      (DBusGProxy *proxy);
+void     tracker_xesam_subscribe_index_updated        (DBusGProxy *proxy);
 void     tracker_xesam_manager_wakeup                 (gpointer user_data);
 
 G_END_DECLS

Modified: branches/indexer-split/src/trackerd/tracker-xesam-query.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-xesam-query.c	(original)
+++ branches/indexer-split/src/trackerd/tracker-xesam-query.c	Thu Jun 12 13:27:46 2008
@@ -1,7 +1,9 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 
 /* Tracker - indexer and metadata database engine
- * Copyright (C) 2006, Mr Jamie McCracken (jamiemcc gnome org)
+ *
+ * Copyright (C) 2008, Nokia
+ * Authors: Ottela Mikael, (mikael ottela ixonos com)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public

Modified: branches/indexer-split/src/trackerd/tracker-xesam-query.h
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-xesam-query.h	(original)
+++ branches/indexer-split/src/trackerd/tracker-xesam-query.h	Thu Jun 12 13:27:46 2008
@@ -1,6 +1,7 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 /*
- * Copyright (C) 2006, Mr Jamie McCracken (jamiemcc gnome org)
+ * Copyright (C) 2008, Nokia
+ * Authors: Ottela Mikael, (mikael ottela ixonos com)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public
@@ -36,3 +37,4 @@
 G_END_DECLS
 
 #endif /* __TRACKERD_XESAM_QUERY_H__ */
+

Modified: branches/indexer-split/tests/Makefile.am
==============================================================================
--- branches/indexer-split/tests/Makefile.am	(original)
+++ branches/indexer-split/tests/Makefile.am	Thu Jun 12 13:27:46 2008
@@ -1,3 +1,4 @@
 include $(top_srcdir)/Makefile.decl
 
-SUBDIRS = libtracker-common
\ No newline at end of file
+SUBDIRS = libtracker-common trackerd
+



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