tracker r1484 - in branches/indexer-split: . src/tracker-indexer
- From: carlosg svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r1484 - in branches/indexer-split: . src/tracker-indexer
- Date: Mon, 26 May 2008 10:34:05 +0000 (UTC)
Author: carlosg
Date: Mon May 26 10:34:05 2008
New Revision: 1484
URL: http://svn.gnome.org/viewvc/tracker?rev=1484&view=rev
Log:
2008-05-26 Carlos Garnacho <carlos imendio com>
* src/tracker-indexer/tracker-indexer.[ch]: Add "reindex" property, to
begin indexing from scratch at startup.
* src/tracker-indexer/main.c: connect reindex to command line option.
Modified:
branches/indexer-split/ChangeLog
branches/indexer-split/src/tracker-indexer/main.c
branches/indexer-split/src/tracker-indexer/tracker-indexer.c
branches/indexer-split/src/tracker-indexer/tracker-indexer.h
Modified: branches/indexer-split/src/tracker-indexer/main.c
==============================================================================
--- branches/indexer-split/src/tracker-indexer/main.c (original)
+++ branches/indexer-split/src/tracker-indexer/main.c Mon May 26 10:34:05 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/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 Mon May 26 10:34:05 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/indexer-split/src/tracker-indexer/tracker-indexer.h
==============================================================================
--- branches/indexer-split/src/tracker-indexer/tracker-indexer.h (original)
+++ branches/indexer-split/src/tracker-indexer/tracker-indexer.h Mon May 26 10:34:05 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]