tracker r1727 - in branches/indexer-split: . data src/trackerd tests/scripts



Author: pvanhoof
Date: Fri Jun 20 14:44:48 2008
New Revision: 1727
URL: http://svn.gnome.org/viewvc/tracker?rev=1727&view=rev

Log:
* svn merge -r 1683:1726 ../xesam-support



Added:
   branches/indexer-split/tests/scripts/testing.txt
      - copied unchanged from r1726, /branches/xesam-support/tests/scripts/testing.txt
Modified:
   branches/indexer-split/ChangeLog
   branches/indexer-split/data/sqlite-cache.sql
   branches/indexer-split/data/sqlite-stored-procs.sql
   branches/indexer-split/src/trackerd/tracker-db.c
   branches/indexer-split/src/trackerd/tracker-xesam-live-search.c
   branches/indexer-split/src/trackerd/tracker-xesam-manager.c
   branches/indexer-split/src/trackerd/tracker-xesam-query.c
   branches/indexer-split/src/trackerd/tracker-xesam.c

Modified: branches/indexer-split/data/sqlite-cache.sql
==============================================================================
--- branches/indexer-split/data/sqlite-cache.sql	(original)
+++ branches/indexer-split/data/sqlite-cache.sql	Fri Jun 20 14:44:48 2008
@@ -68,6 +68,7 @@
 	unique (URI)
 );
 
+
 CREATE TABLE Events
 (
 	ID		Integer primary key not null,

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	Fri Jun 20 14:44:48 2008
@@ -29,12 +29,12 @@
 GetEvents SELECT ID, ServiceID, EventType FROM Events WHERE BeingHandled = 1;
 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 = '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'
+GetLiveSearchAllIDs SELECT X.ServiceID FROM cache.LiveSearches AS X WHERE X.SearchID = ?
+GetLiveSearchDeletedIDs SELECT E.ServiceID FROM Events as E, cache.LiveSearches as X WHERE E.ServiceID = X.ServiceID AND X.SearchID = ? AND E.EventType = 'Delete';
+DeleteLiveSearchDeletedIDs DELETE FROM cache.LiveSearches AS Y WHERE Y.ServiceID IN SELECT ServiceID FROM Events as E, cache.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 WHERE SearchID = ?
+GetLiveSearchHitCount SELECT count(*) FROM cache.LiveSearches WHERE SearchID = ?;
+LiveSearchStopSearch DELETE FROM cache.LiveSearches WHERE SearchID = ?
 
 GetNewEventID SELECT OptionValue FROM Options WHERE OptionKey = 'EventSequence';
 UpdateNewEventID UPDATE Options set OptionValue = ? WHERE OptionKey = 'EventSequence';
@@ -212,4 +212,4 @@
 GetXesamMetaDataLookups SELECT DISTINCT MetaName FROM XesamMetaDataLookup WHERE XesamMetaName = ?;
 
 GetXesamMetaDataTypes SELECT ID, MetaName, DataTypeID, FieldName, Weight, Embedded, MultipleValues, Delimited, Filtered, Abstract FROM XesamMetaDataTypes;
-GetXesamServiceTypes SELECT TypeID, TypeName, Parents, Enabled, Embedded, HasMetadata, HasFullText, HasThumbs, ContentMetadata, Database, ShowServiceFiles, ShowServiceDirectories, KeyMetadata1, KeyMetadata2, KeyMetadata3, KeyMetadata4, KeyMetadata5, KeyMetadata6, KeyMetadata7, KeyMetadata8, KeyMetadata9, KeyMetadata10, KeyMetadata11  FROM XesamServiceTypes;
\ No newline at end of file
+GetXesamServiceTypes SELECT TypeID, TypeName, Parents, Enabled, Embedded, HasMetadata, HasFullText, HasThumbs, ContentMetadata, Database, ShowServiceFiles, ShowServiceDirectories, KeyMetadata1, KeyMetadata2, KeyMetadata3, KeyMetadata4, KeyMetadata5, KeyMetadata6, KeyMetadata7, KeyMetadata8, KeyMetadata9, KeyMetadata10, KeyMetadata11  FROM XesamServiceTypes;

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	Fri Jun 20 14:44:48 2008
@@ -2359,8 +2359,14 @@
 	g_return_if_fail (where_query != NULL);
 	g_return_if_fail (search_id != NULL);
 
+	g_message ("INSERT INTO cache.LiveSearches SELECT S.ID, '%s' %s %s %s",
+				  search_id, 
+				  from_query, 
+				  join_query, 
+				  where_query);
+
 	tracker_db_exec_no_reply (iface,
-				  "INSERT INTO LiveSearches SELECT S.ID, '%s' %s %s %s",
+				  "INSERT INTO cache.LiveSearches SELECT S.ID, '%s' %s %s %s",
 				  search_id, 
 				  from_query, 
 				  join_query, 
@@ -2452,9 +2458,11 @@
 	g_return_val_if_fail (query_joins != NULL, NULL);
 	g_return_val_if_fail (where_query != NULL, NULL);
 
+	// We need to add 'file-meta' and 'email-meta' here
+
 	result_set = tracker_db_exec (iface,
 				      "SELECT E.ServiceID, E.EventType "
-				      "%s%s LiveSearches as X, Events as E " /* FROM   A1 */
+				      "%s%s cache.LiveSearches as X, Events as E " /* FROM   A1 */
 				       "%s"                                  /* JOINS  A2 */
 				       "%s"                                  /* WHERE  A3 */
 				      "%sX.ServiceID = E.ServiceID "
@@ -2480,7 +2488,7 @@
 				      where_query ? "AND " : "");            /*        B3 */ 
 	
 	tracker_db_exec_no_reply (iface,
-				  "INSERT INTO LiveSearches "
+				  "INSERT INTO cache.LiveSearches "
 				   "SELECT E.ServiceID, '%s' "               /*        B0 */
 				  "%s%s Events as E "                        /* FROM   B1 */ 
 				  "%s"                                       /* JOINS  B2 */ 
@@ -2655,7 +2663,7 @@
 		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 ",
+					"INNER JOIN 'files-meta'.%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),
@@ -2664,13 +2672,13 @@
 		g_free (field_name);
 	}
 
-	g_debug("Query : SELECT %s FROM LiveSearches as X \n"
+	g_debug("Query : SELECT %s FROM cache.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"
+				  "SELECT %s FROM cache.LiveSearches as X \n"
 				  "%s"
 				  "WHERE X.SearchID = '%s'", 
 				  sql_select->str, sql_join->str, search_id);

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	Fri Jun 20 14:44:48 2008
@@ -481,6 +481,9 @@
 		
 		iface = tracker_db_manager_get_db_interface (TRACKER_DB_XESAM);
 
+		g_message ("Closing search '%s'", 
+			   tracker_xesam_live_search_get_id (self));
+
 		tracker_db_live_search_stop (iface, 
 					     tracker_xesam_live_search_get_id (self));
 	}
@@ -1276,7 +1279,7 @@
 		g_free (orig_where);
 	}
 
-	g_message ("Parsed to '%s', '%s' and '%s'", 
+	g_message ("Parsed to:\n\t%s\n\t%s\n\t%s", 
 		   priv->from_sql,
 		   priv->join_sql,
 		   priv->where_sql);

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	Fri Jun 20 14:44:48 2008
@@ -138,8 +138,9 @@
 			     g_strdup (tracker_xesam_session_get_id (session)),
 			     g_object_ref (session));
 
-	if (session_id)
+	if (session_id) {
 		*session_id = g_strdup (tracker_xesam_session_get_id (session));
+	}
 
 	return session;
 }
@@ -149,13 +150,15 @@
 				     GError      **error)
 {
 	gpointer inst = g_hash_table_lookup (xesam_sessions, session_id);
-	if (!inst)
+
+	if (!inst) {
 		g_set_error (error, 
 			     TRACKER_XESAM_ERROR_DOMAIN, 
 			     TRACKER_XESAM_ERROR_SESSION_ID_NOT_REGISTERED,
 			     "Session ID is not registered");
-	else
+	} else {
 		g_hash_table_remove (xesam_sessions, session_id);
+	}
 }
 
 TrackerXesamSession *
@@ -163,13 +166,16 @@
 				   GError      **error)
 {
 	TrackerXesamSession *session = g_hash_table_lookup (xesam_sessions, session_id);
-	if (session)
+
+	if (session) {
 		g_object_ref (session);
-	else
+	} else {
 		g_set_error (error,
 			     TRACKER_XESAM_ERROR_DOMAIN, 
 			     TRACKER_XESAM_ERROR_SESSION_ID_NOT_REGISTERED,
 			     "Session ID is not registered");
+	}
+
 	return session;
 }
 
@@ -187,6 +193,7 @@
 		TrackerXesamLiveSearch *search;
 
 		search = tracker_xesam_session_get_search (sessions->data, search_id, NULL);
+
 		if (search) {
 			/* Search got a reference added already */
 			if (search_in) {
@@ -204,11 +211,13 @@
 
 	g_list_free (sessions);
 
-	if (!session) 
+	if (!session) {
 		g_set_error (error, 
 			     TRACKER_XESAM_ERROR_DOMAIN, 
 			     TRACKER_XESAM_ERROR_SEARCH_ID_NOT_REGISTERED,
 			     "Search ID is not registered");
+	}
+
 	return session;
 }
 
@@ -223,8 +232,9 @@
 
 	while (sessions) {
 		TrackerXesamLiveSearch *p;
-		
+
 		p = tracker_xesam_session_get_search (sessions->data, search_id, NULL);
+
 		if (p) {
 			/* Search got a reference added already */
 			search = p;
@@ -236,11 +246,12 @@
 
 	g_list_free (sessions);
 
-	if (!search) 
+	if (!search) {
 		g_set_error (error, 
 			     TRACKER_XESAM_ERROR_DOMAIN, 
 			     TRACKER_XESAM_ERROR_SEARCH_ID_NOT_REGISTERED,
 			     "Search ID is not registered");
+	}
 
 	return search;
 }

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	Fri Jun 20 14:44:48 2008
@@ -50,6 +50,7 @@
 #define ELEMENT_XESAM_QUERY 	        "query"
 #define ELEMENT_XESAM_USER_QUERY        "userQuery"
 #define ELEMENT_XESAM_FIELD 		"field"
+#define ELEMENT_XESAM_REQUEST 		"request"
 
 /* Operators */
 #define ELEMENT_XESAM_AND 		"and"
@@ -478,7 +479,7 @@
 		}
 
 		g_string_append_printf (data->sql_where,
-					"\n WHERE (S.ServiceTypeID in (select TypeId from ServiceTypes where TypeName = '%s' or Parent = '%s')) AND ", 
+					" WHERE (S.ServiceTypeID in (select TypeId from ServiceTypes where TypeName = '%s' or Parent = '%s')) AND ", 
 					content, 
 					source);
 
@@ -843,6 +844,17 @@
 			return;
 		}
 		push_stack (data, STATE_BOOLEAN);
+	} else if (ELEMENT_IS (ELEMENT_XESAM_REQUEST)) {
+		/* Ignore */
+	} else {
+		g_warning ("%s not supported", element_name);
+
+		if (set_error_on_fail (FALSE, 
+				       context, 
+				       "Unsupported query", 
+				       error)) {
+			return;
+		}
 	}
 }
 
@@ -935,10 +947,10 @@
 				
 		if (data->statement_count > 1) {
 			if (data->current_logic_operator == LOP_AND) {
-				data->sql_where = g_string_append (data->sql_where, "\n AND ");
+				data->sql_where = g_string_append (data->sql_where, " AND ");
 			} else {
 				if (data->current_logic_operator == LOP_OR) {
-					data->sql_where = g_string_append (data->sql_where, "\n OR ");
+					data->sql_where = g_string_append (data->sql_where, " OR ");
 				}
 			}
 		}
@@ -1294,7 +1306,7 @@
 	table_name = "Services";
 
 	data.sql_from = g_string_new ("");
-	g_string_append_printf (data.sql_from, "\n FROM %s S ", table_name);
+	g_string_append_printf (data.sql_from, " FROM 'file-meta'.%s S ", table_name);
 	
 	data.sql_join = g_string_new ("");
 	data.sql_where = g_string_new ("");
@@ -1330,7 +1342,7 @@
 			if (!tracker_field_data_get_is_condition (l->data)) {
 				if (tracker_field_data_get_needs_join (l->data)) {
 					g_string_append_printf (data.sql_join, 
-								"\n LEFT OUTER JOIN %s %s ON (S.ID = %s.ServiceID and %s.MetaDataID = %s) ", 
+								" LEFT OUTER JOIN 'file-meta'.%s %s ON (S.ID = %s.ServiceID and %s.MetaDataID = %s) ", 
 								tracker_field_data_get_table_name (l->data),
 								tracker_field_data_get_alias (l->data),
 								tracker_field_data_get_alias (l->data),
@@ -1343,7 +1355,7 @@
 				related_metadata = tracker_db_metadata_get_related_names (iface, 
 											  tracker_field_data_get_field_name (l->data));
 				g_string_append_printf (data.sql_join, 
-							"\n INNER JOIN %s %s ON (S.ID = %s.ServiceID and %s.MetaDataID in (%s)) ",
+							" INNER JOIN 'file-meta'.%s %s ON (S.ID = %s.ServiceID and %s.MetaDataID in (%s)) ",
 							tracker_field_data_get_table_name (l->data),
 							tracker_field_data_get_alias (l->data),
 							tracker_field_data_get_alias (l->data),

Modified: branches/indexer-split/src/trackerd/tracker-xesam.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-xesam.c	(original)
+++ branches/indexer-split/src/trackerd/tracker-xesam.c	Fri Jun 20 14:44:48 2008
@@ -409,15 +409,15 @@
 		if (error) {
 			dbus_g_method_return_error (context, error);
 			g_error_free (error);
-		} else 
+		} else {
+			g_debug ("Created new xesam search: %s  for session: %s",
+				search_id, session_id);
 			dbus_g_method_return (context, search_id);
+		}
 
 		if (search)
 			g_object_unref (search);
 
-		g_debug ("Created new xesam search: %s  for session: %s",
-			 search_id, session_id);
-
 		g_free (search_id);
 
 	} else if (error) {



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