[tracker] Remove PropertySet and PropertyRemove methods from Indexer



commit 71c96d689cb301d6e0dde537819c2fb4634268a2
Author: Jürg Billeter <j bitron ch>
Date:   Wed Apr 15 13:50:26 2009 +0200

    Remove PropertySet and PropertyRemove methods from Indexer
---
 data/dbus/tracker-indexer.xml         |   16 ---
 src/tracker-indexer/tracker-indexer.c |  199 ---------------------------------
 src/tracker-indexer/tracker-indexer.h |   14 ---
 3 files changed, 0 insertions(+), 229 deletions(-)

diff --git a/data/dbus/tracker-indexer.xml b/data/dbus/tracker-indexer.xml
index e084b84..2e85b8c 100644
--- a/data/dbus/tracker-indexer.xml
+++ b/data/dbus/tracker-indexer.xml
@@ -44,22 +44,6 @@
       <arg type="b" name="enabled" direction="in" />
     </method>
 
-    <method name="PropertySet">
-      <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/>
-      <arg type="s" name="service_type" direction="in" />
-      <arg type="s" name="uri" direction="in" />
-      <arg type="s" name="property" direction="in"/>
-      <arg type="as" name="values" direction="in"/>
-    </method>      
-
-    <method name="PropertyRemove">
-      <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/>
-      <arg type="s" name="service_type" direction="in" />
-      <arg type="s" name="uri" direction="in" />
-      <arg type="s" name="property" direction="in"/>
-      <arg type="as" name="values" direction="in"/>
-    </method>
-
     <method name="Pause">
       <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/>
     </method>
diff --git a/src/tracker-indexer/tracker-indexer.c b/src/tracker-indexer/tracker-indexer.c
index 9eee385..deaa8a7 100644
--- a/src/tracker-indexer/tracker-indexer.c
+++ b/src/tracker-indexer/tracker-indexer.c
@@ -2332,114 +2332,6 @@ handle_metadata_add (TrackerIndexer *indexer,
 }
 
 static gboolean
-handle_metadata_remove (TrackerIndexer *indexer,
-			const gchar    *service_type,
-			const gchar    *uri,
-			const gchar    *property,
-			GStrv		values,
-			GError	      **error)
-{
-	TrackerService *service;
-	TrackerField *field;
-	guint service_id, i;
-	gchar *joined = NULL, *dirname = NULL, *basename = NULL;
-
-	check_started (indexer);
-
-	service = tracker_ontology_get_service_by_name (service_type);
-	if (!service) {
-		g_set_error (error,
-			     g_quark_from_string (TRACKER_INDEXER_ERROR),
-			     TRACKER_INDEXER_ERROR_CODE,
-			     "Unknown service type: '%s'",
-			     service_type);
-		return FALSE;
-	}
-
-	field = tracker_ontology_get_field_by_name (property);
-	if (!field) {
-		g_set_error (error,
-			     g_quark_from_string (TRACKER_INDEXER_ERROR),
-			     TRACKER_INDEXER_ERROR_CODE,
-			     "Unknown field type: '%s'",
-			     property);
-		return FALSE;
-	}
-
-	if (tracker_field_get_embedded (field)) {
-		g_set_error (error,
-			     g_quark_from_string (TRACKER_INDEXER_ERROR),
-			     TRACKER_INDEXER_ERROR_CODE,
-			     "Field type: '%s' is embedded and cannot be deleted",
-			     property);
-		return FALSE;
-	}
-
-	tracker_file_get_path_and_name (uri, &dirname, &basename);
-
-	tracker_data_query_service_exists (service, dirname, basename, &service_id, NULL);
-
-	g_free (dirname);
-	g_free (basename);
-
-	if (service_id < 1) {
-		g_set_error (error,
-			     g_quark_from_string (TRACKER_INDEXER_ERROR),
-			     TRACKER_INDEXER_ERROR_CODE,
-			     "File '%s' doesnt exist in the DB", uri);
-		return FALSE;
-	}
-
-	/* If we receive concrete values, we delete those rows in the
-	 * db. Otherwise, retrieve the old values of the property and
-	 * remove all their instances for the file
-	 */
-	if (g_strv_length (values) > 0) {
-		for (i = 0; values[i] != NULL; i++) {
-			tracker_data_update_delete_metadata (service,
-						    service_id,
-						    field,
-						    values[i]);
-		}
-		joined = g_strjoinv (" ", values);
-	} else {
-		gchar **old_contents;
-
-		old_contents = tracker_data_query_metadata_field_values (service,
-							       service_id,
-							       field);
-		if (old_contents) {
-			tracker_data_update_delete_metadata (service,
-						    service_id,
-						    field,
-						    NULL);
-
-			joined = g_strjoinv (" ", old_contents);
-			g_strfreev (old_contents);
-		}
-	}
-
-	/* Now joined contains the words to unindex */
-	if (tracker_field_get_filtered (field)) {
-		unindex_text_with_parsing (indexer,
-					   service_id,
-					   tracker_service_get_id (service),
-					   joined,
-					   tracker_field_get_weight (field));
-	} else {
-		unindex_text_no_parsing (indexer,
-					 service_id,
-					 tracker_service_get_id (service),
-					 joined,
-					 tracker_field_get_weight (field));
-	}
-
-	g_free (joined);
-
-	return TRUE;
-}
-
-static gboolean
 should_change_index_for_file (TrackerIndexer *indexer,
 			      PathInfo        *info,
 			      const gchar	  *dirname,
@@ -3324,97 +3216,6 @@ tracker_indexer_volume_update_state (TrackerIndexer         *indexer,
 	}
 }
 
-void
-tracker_indexer_property_set (TrackerIndexer	     *indexer,
-			      const gchar	     *service_type,
-			      const gchar	     *uri,
-			      const gchar	     *property,
-			      GStrv		      values,
-			      DBusGMethodInvocation  *context,
-			      GError		    **error)
-{
-	guint	request_id;
-	GError *actual_error = NULL;
-
-	request_id = tracker_dbus_get_next_request_id ();
-
-	tracker_dbus_async_return_if_fail (TRACKER_IS_INDEXER (indexer), context);
-	tracker_dbus_async_return_if_fail (service_type != NULL, context);
-	tracker_dbus_async_return_if_fail (uri != NULL, context);
-	tracker_dbus_async_return_if_fail (property != NULL, context);
-	tracker_dbus_async_return_if_fail (values != NULL, context);
-	tracker_dbus_async_return_if_fail (g_strv_length (values) > 0, context);
-
-	tracker_dbus_request_new (request_id,
-				  "DBus request to set %d values in property '%s' for file '%s' ",
-				  g_strv_length (values),
-				  property,
-				  uri);
-
-	if (!handle_metadata_add (indexer,
-				  service_type,
-				  uri,
-				  property,
-				  values,
-				  &actual_error)) {
-		tracker_dbus_request_failed (request_id,
-					     &actual_error,
-					     NULL);
-		dbus_g_method_return_error (context, actual_error);
-		g_error_free (actual_error);
-		return;
-	}
-
-	schedule_flush (indexer, TRUE);
-
-	dbus_g_method_return (context);
-	tracker_dbus_request_success (request_id);
-}
-
-void
-tracker_indexer_property_remove (TrackerIndexer		*indexer,
-				 const gchar		*service_type,
-				 const gchar		*uri,
-				 const gchar		*property,
-				 GStrv			 values,
-				 DBusGMethodInvocation	*context,
-				 GError		       **error)
-{
-	guint	request_id;
-	GError *actual_error = NULL;
-
-	request_id = tracker_dbus_get_next_request_id ();
-
-	tracker_dbus_async_return_if_fail (TRACKER_IS_INDEXER (indexer), context);
-	tracker_dbus_async_return_if_fail (service_type != NULL, context);
-	tracker_dbus_async_return_if_fail (uri != NULL, context);
-	tracker_dbus_async_return_if_fail (property != NULL, context);
-	tracker_dbus_async_return_if_fail (values != NULL, context);
-
-	tracker_dbus_request_new (request_id,
-				  "DBus request to remove %d values in property '%s' for file '%s' ",
-				  g_strv_length (values),
-				  property,
-				  uri);
-
-	if (!handle_metadata_remove (indexer,
-				     service_type,
-				     uri,
-				     property,
-				     values,
-				     &actual_error)) {
-		tracker_dbus_request_failed (request_id,
-					     &actual_error,
-					     NULL);
-		dbus_g_method_return_error (context, actual_error);
-		g_error_free (actual_error);
-		return;
-	}
-
-	dbus_g_method_return (context);
-	tracker_dbus_request_success (request_id);
-}
-
 static void
 restore_backup_cb (const gchar *subject,
 		   const gchar *predicate,
diff --git a/src/tracker-indexer/tracker-indexer.h b/src/tracker-indexer/tracker-indexer.h
index 9b2646a..0972e48 100644
--- a/src/tracker-indexer/tracker-indexer.h
+++ b/src/tracker-indexer/tracker-indexer.h
@@ -134,20 +134,6 @@ void            tracker_indexer_volume_update_state (TrackerIndexer         *ind
 						     gboolean                enabled,
 						     DBusGMethodInvocation  *context,
 						     GError                **error);
-void            tracker_indexer_property_set        (TrackerIndexer         *indexer,
-						     const gchar            *service_type,
-						     const gchar            *uri,
-						     const gchar            *property,
-						     GStrv                   values,
-						     DBusGMethodInvocation  *context,
-						     GError                **error);
-void            tracker_indexer_property_remove     (TrackerIndexer         *indexer,
-						     const gchar            *service_type,
-						     const gchar            *uri,
-						     const gchar            *property,
-						     GStrv                   values,
-						     DBusGMethodInvocation  *context,
-						     GError                **error);
 void            tracker_indexer_restore_backup      (TrackerIndexer         *indexer,
 						     const gchar            *backup_file,
 						     DBusGMethodInvocation  *context,



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