tracker r1488 - in branches/xesam-support: . src/tracker-indexer src/trackerd



Author: pvanhoof
Date: Mon May 26 14:02:25 2008
New Revision: 1488
URL: http://svn.gnome.org/viewvc/tracker?rev=1488&view=rev

Log:
2008-05-26  Philip Van Hoof  <pvanhoof gnome org>

        * Merged xesam-support with indexer-split
	 svn merge -r 1481:1487 ../indexer-split



Added:
   branches/xesam-support/src/tracker-indexer/tracker-field.c
      - copied unchanged from r1487, /branches/indexer-split/src/tracker-indexer/tracker-field.c
   branches/xesam-support/src/tracker-indexer/tracker-field.h
      - copied unchanged from r1487, /branches/indexer-split/src/tracker-indexer/tracker-field.h
   branches/xesam-support/src/tracker-indexer/tracker-ontology.c
      - copied unchanged from r1487, /branches/indexer-split/src/tracker-indexer/tracker-ontology.c
   branches/xesam-support/src/tracker-indexer/tracker-ontology.h
      - copied unchanged from r1487, /branches/indexer-split/src/tracker-indexer/tracker-ontology.h
   branches/xesam-support/src/tracker-indexer/tracker-service.c
      - copied unchanged from r1487, /branches/indexer-split/src/tracker-indexer/tracker-service.c
   branches/xesam-support/src/tracker-indexer/tracker-service.h
      - copied unchanged from r1487, /branches/indexer-split/src/tracker-indexer/tracker-service.h
Modified:
   branches/xesam-support/ChangeLog
   branches/xesam-support/src/tracker-indexer/Makefile.am
   branches/xesam-support/src/tracker-indexer/main.c
   branches/xesam-support/src/tracker-indexer/tracker-indexer.c
   branches/xesam-support/src/tracker-indexer/tracker-indexer.h
   branches/xesam-support/src/trackerd/tracker-dbus-search.c

Modified: branches/xesam-support/src/tracker-indexer/Makefile.am
==============================================================================
--- branches/xesam-support/src/tracker-indexer/Makefile.am	(original)
+++ branches/xesam-support/src/tracker-indexer/Makefile.am	Mon May 26 14:02:25 2008
@@ -46,10 +46,16 @@
 
 tracker_indexer_SOURCES =						\
 	main.c								\
+	tracker-field.c							\
+	tracker-field.h							\
 	tracker-indexer.c						\
 	tracker-indexer.h						\
 	tracker-indexer-module.c					\
-	tracker-indexer-module.h
+	tracker-indexer-module.h					\
+	tracker-ontology.c						\
+	tracker-ontology.h						\
+	tracker-service.c						\
+	tracker-service.h
 
 tracker_indexer_LDADD =							\
 	$(GLIB2_LIBS)							\

Modified: branches/xesam-support/src/tracker-indexer/main.c
==============================================================================
--- branches/xesam-support/src/tracker-indexer/main.c	(original)
+++ branches/xesam-support/src/tracker-indexer/main.c	Mon May 26 14:02:25 2008
@@ -235,7 +235,7 @@
 
 	g_print ("Initializing...\n");
 
-	indexer = tracker_indexer_new ();
+	indexer = tracker_indexer_new (reindex);
 	main_loop = g_main_loop_new (NULL, FALSE);
 
 	g_signal_connect (indexer, "finished",

Modified: branches/xesam-support/src/tracker-indexer/tracker-indexer.c
==============================================================================
--- branches/xesam-support/src/tracker-indexer/tracker-indexer.c	(original)
+++ branches/xesam-support/src/tracker-indexer/tracker-indexer.c	Mon May 26 14:02:25 2008
@@ -44,9 +44,12 @@
 #include <stdlib.h>
 #include <string.h>
 #include <gmodule.h>
+#include <glib/gstdio.h>
 
 #include <libtracker-common/tracker-config.h>
+#include <libtracker-common/tracker-file-utils.h>
 #include <libtracker-db/tracker-db-interface-sqlite.h>
+#include <qdbm/depot.h>
 
 #include "tracker-indexer.h"
 #include "tracker-indexer-module.h"
@@ -64,11 +67,17 @@
 	GSList *current_module;
 	GHashTable *indexer_modules;
 
-	TrackerDBInterface *index;
+	gchar *db_dir;
+
+	DEPOT *index;
+	TrackerDBInterface *metadata;
+	TrackerDBInterface *contents;
 
 	TrackerConfig *config;
 
 	guint idle_id;
+
+	guint reindex : 1;
 };
 
 struct PathInfo {
@@ -78,7 +87,8 @@
 
 enum {
 	PROP_0,
-	PROP_RUNNING
+	PROP_RUNNING,
+	PROP_REINDEX
 };
 
 enum {
@@ -117,6 +127,8 @@
 
 	priv = TRACKER_INDEXER_GET_PRIVATE (object);
 
+	g_free (priv->db_dir);
+
 	g_queue_foreach (priv->dir_queue, (GFunc) path_info_free, NULL);
 	g_queue_free (priv->dir_queue);
 
@@ -146,6 +158,9 @@
 	case PROP_RUNNING:
 		tracker_indexer_set_running (indexer, g_value_get_boolean (value));
 		break;
+	case PROP_REINDEX:
+		priv->reindex = g_value_get_boolean (value);
+		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 	}
@@ -194,6 +209,13 @@
 							       "Whether the indexer is running",
 							       TRUE,
 							       G_PARAM_READWRITE));
+	g_object_class_install_property (object_class,
+					 PROP_REINDEX,
+					 g_param_spec_boolean ("reindex",
+							       "Reindex",
+							       "Whether to reindex contents",
+							       FALSE,
+							       G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
 
 	g_type_class_add_private (object_class,
 				  sizeof (TrackerIndexerPrivate));
@@ -202,6 +224,14 @@
 static gboolean
 init_indexer (TrackerIndexer *indexer)
 {
+	TrackerIndexerPrivate *priv;
+
+	priv = TRACKER_INDEXER_GET_PRIVATE (indexer);
+
+	if (priv->reindex) {
+		tracker_dir_remove (priv->db_dir);
+	}
+
 	tracker_indexer_set_running (indexer, TRUE);
 	return FALSE;
 }
@@ -239,6 +269,9 @@
 	priv->file_process_queue = g_queue_new ();
 	priv->config = tracker_config_new ();
 
+	priv->db_dir = g_build_filename (g_get_user_cache_dir (),
+					 "tracker", NULL);
+
 	priv->index = create_db_interface ("file-meta.db");
 
 	priv->module_names = tracker_config_get_index_modules (priv->config);
@@ -442,9 +475,11 @@
 }
 
 TrackerIndexer *
-tracker_indexer_new (void)
+tracker_indexer_new (gboolean reindex)
 {
-	return g_object_new (TRACKER_TYPE_INDEXER, NULL);
+	return g_object_new (TRACKER_TYPE_INDEXER,
+			     "reindex", reindex,
+			     NULL);
 }
 
 void
@@ -481,5 +516,5 @@
 
 	priv = TRACKER_INDEXER_GET_PRIVATE (indexer);
 
-	return (priv->idle_id == 0);
+	return (priv->idle_id != 0);
 }

Modified: branches/xesam-support/src/tracker-indexer/tracker-indexer.h
==============================================================================
--- branches/xesam-support/src/tracker-indexer/tracker-indexer.h	(original)
+++ branches/xesam-support/src/tracker-indexer/tracker-indexer.h	Mon May 26 14:02:25 2008
@@ -49,7 +49,7 @@
 };
 
 GType           tracker_indexer_get_type    (void) G_GNUC_CONST;
-TrackerIndexer *tracker_indexer_new         (void);
+TrackerIndexer *tracker_indexer_new         (gboolean        reindex);
 void            tracker_indexer_set_running (TrackerIndexer *indexer,
                                              gboolean        running);
 gboolean        tracker_indexer_get_running (TrackerIndexer *indexer);

Modified: branches/xesam-support/src/trackerd/tracker-dbus-search.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-dbus-search.c	(original)
+++ branches/xesam-support/src/trackerd/tracker-dbus-search.c	Mon May 26 14:02:25 2008
@@ -454,11 +454,11 @@
 		}
 
 		g_strfreev (single_term);
-		g_free (text_copy);
-
-		text_copy = g_string_free (s, FALSE);
 	}
 
+	g_free (text_copy);
+	text_copy = g_string_free (s, FALSE);
+
 	return text_copy;
 }
 



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