tracker r2015 - in branches/indexer-split: . src/trackerd
- From: mr svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r2015 - in branches/indexer-split: . src/trackerd
- Date: Wed, 6 Aug 2008 15:22:14 +0000 (UTC)
Author: mr
Date: Wed Aug 6 15:22:14 2008
New Revision: 2015
URL: http://svn.gnome.org/viewvc/tracker?rev=2015&view=rev
Log:
* src/trackerd/tracker-dbus.[ch]:
* src/trackerd/tracker-index-manager.[ch]:
* src/trackerd/tracker-main.c:
* src/trackerd/tracker-processor.c:
* src/trackerd/tracker-search.[ch]: Removed the email index since
it is unused now.
Modified:
branches/indexer-split/ChangeLog
branches/indexer-split/src/trackerd/tracker-dbus.c
branches/indexer-split/src/trackerd/tracker-dbus.h
branches/indexer-split/src/trackerd/tracker-index-manager.c
branches/indexer-split/src/trackerd/tracker-index-manager.h
branches/indexer-split/src/trackerd/tracker-main.c
branches/indexer-split/src/trackerd/tracker-processor.c
branches/indexer-split/src/trackerd/tracker-search.c
branches/indexer-split/src/trackerd/tracker-search.h
Modified: branches/indexer-split/src/trackerd/tracker-dbus.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-dbus.c (original)
+++ branches/indexer-split/src/trackerd/tracker-dbus.c Wed Aug 6 15:22:14 2008
@@ -301,16 +301,14 @@
gboolean
tracker_dbus_register_objects (TrackerConfig *config,
TrackerLanguage *language,
- TrackerIndex *file_index,
- TrackerIndex *email_index,
+ TrackerIndex *index,
TrackerProcessor *processor)
{
gpointer object;
g_return_val_if_fail (TRACKER_IS_CONFIG (config), FALSE);
g_return_val_if_fail (TRACKER_IS_LANGUAGE (language), FALSE);
- g_return_val_if_fail (TRACKER_IS_INDEX (file_index), FALSE);
- g_return_val_if_fail (TRACKER_IS_INDEX (email_index), FALSE);
+ g_return_val_if_fail (TRACKER_IS_INDEX (index), FALSE);
if (!connection || !proxy) {
g_critical ("DBus support must be initialized before registering objects!");
@@ -374,7 +372,7 @@
objects = g_slist_prepend (objects, object);
/* Add org.freedesktop.Tracker.Search */
- object = tracker_search_new (config, language, file_index, email_index);
+ object = tracker_search_new (config, language, index);
if (!object) {
g_critical ("Could not create TrackerSearch object to register");
return FALSE;
Modified: branches/indexer-split/src/trackerd/tracker-dbus.h
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-dbus.h (original)
+++ branches/indexer-split/src/trackerd/tracker-dbus.h Wed Aug 6 15:22:14 2008
@@ -38,8 +38,7 @@
void tracker_dbus_shutdown (void);
gboolean tracker_dbus_register_objects (TrackerConfig *config,
TrackerLanguage *language,
- TrackerIndex *file_index,
- TrackerIndex *email_index,
+ TrackerIndex *file,
TrackerProcessor *processor);
GObject *tracker_dbus_get_object (GType type);
DBusGProxy *tracker_dbus_indexer_get_proxy (void);
Modified: branches/indexer-split/src/trackerd/tracker-index-manager.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-index-manager.c (original)
+++ branches/indexer-split/src/trackerd/tracker-index-manager.c Wed Aug 6 15:22:14 2008
@@ -31,9 +31,8 @@
#define MIN_BUCKET_DEFAULT 10
#define MAX_BUCKET_DEFAULT 20
-#define TRACKER_INDEX_FILE_INDEX_FILENAME "file-index.db"
-#define TRACKER_INDEX_EMAIL_INDEX_FILENAME "email-index.db"
-#define TRACKER_INDEX_FILE_UPDATE_INDEX_FILENAME "file-update-index.db"
+#define TRACKER_INDEX_FILENAME "index.db"
+#define TRACKER_INDEX_UPDATE_FILENAME "index-update.db"
#define MAX_INDEX_FILE_SIZE 2000000000
@@ -48,20 +47,15 @@
static gboolean initialized;
static TrackerIndexDefinition indexes[] = {
- { TRACKER_INDEX_TYPE_FILES,
+ { TRACKER_INDEX_TYPE_INDEX,
NULL,
- TRACKER_INDEX_FILE_INDEX_FILENAME,
- "file-index",
+ TRACKER_INDEX_FILENAME,
+ "index",
NULL },
- { TRACKER_INDEX_TYPE_EMAILS,
+ { TRACKER_INDEX_TYPE_INDEX_UPDATE,
NULL,
- TRACKER_INDEX_EMAIL_INDEX_FILENAME,
- "email-index",
- NULL },
- { TRACKER_INDEX_TYPE_FILES_UPDATE,
- NULL,
- TRACKER_INDEX_FILE_UPDATE_INDEX_FILENAME,
- "file-update-index",
+ TRACKER_INDEX_UPDATE_FILENAME,
+ "index-update",
NULL }
};
@@ -72,11 +66,17 @@
GFileEnumerator *enumerator;
GFileInfo *info;
GError *error = NULL;
- const gchar *prefix;
+ gchar *prefix;
const gchar *data_dir;
gchar *dirname;
gboolean found;
+ if (type != TRACKER_INDEX_TYPE_INDEX) {
+ return FALSE;
+ }
+
+ prefix = g_strconcat (indexes[TRACKER_INDEX_TYPE_INDEX].name, ".tmp", NULL);
+
dirname = g_path_get_dirname (indexes[type].abs_filename);
file = g_file_new_for_path (dirname);
@@ -94,18 +94,13 @@
error->message);
g_error_free (error);
- g_free (dirname);
g_object_unref (file);
+ g_free (dirname);
+ g_free (prefix);
return FALSE;
}
- if (type == TRACKER_INDEX_TYPE_FILES) {
- prefix = "file-index.tmp.";
- } else {
- prefix = "email-index.tmp.";
- }
-
found = FALSE;
for (info = g_file_enumerator_next_file (enumerator, NULL, &error);
@@ -130,6 +125,7 @@
g_object_unref (enumerator);
g_object_unref (file);
g_free (dirname);
+ g_free (prefix);
return found;
}
@@ -141,6 +137,7 @@
gint max_bucket)
{
gchar *final_index_filename;
+ gchar *name;
gboolean need_reindex = FALSE;
guint i;
@@ -172,9 +169,10 @@
g_message ("Merging old temporary indexes");
- /* Files */
- i = TRACKER_INDEX_TYPE_FILES;
- final_index_filename = g_build_filename (data_dir, "file-index-final", NULL);
+ i = TRACKER_INDEX_TYPE_INDEX;
+ name = g_strconcat (indexes[i].name, "-final", NULL);
+ final_index_filename = g_build_filename (data_dir, name, NULL);
+ g_free (name);
if (g_file_test (final_index_filename, G_FILE_TEST_EXISTS) &&
!has_tmp_merge_files (i)) {
@@ -187,21 +185,6 @@
g_free (final_index_filename);
- /* Emails */
- i = TRACKER_INDEX_TYPE_EMAILS;
- final_index_filename = g_build_filename (data_dir, "email-index-final", NULL);
-
- if (g_file_test (final_index_filename, G_FILE_TEST_EXISTS) &&
- !has_tmp_merge_files (i)) {
- g_message (" Overwriting '%s' with '%s'",
- indexes[i].abs_filename,
- final_index_filename);
-
- g_rename (final_index_filename, indexes[i].abs_filename);
- }
-
- g_free (final_index_filename);
-
/* Now we have cleaned up merge files, see if we are supposed
* to be reindexing.
*/
Modified: branches/indexer-split/src/trackerd/tracker-index-manager.h
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-index-manager.h (original)
+++ branches/indexer-split/src/trackerd/tracker-index-manager.h Wed Aug 6 15:22:14 2008
@@ -29,9 +29,8 @@
#include "tracker-index.h"
typedef enum {
- TRACKER_INDEX_TYPE_FILES,
- TRACKER_INDEX_TYPE_EMAILS,
- TRACKER_INDEX_TYPE_FILES_UPDATE
+ TRACKER_INDEX_TYPE_INDEX,
+ TRACKER_INDEX_TYPE_INDEX_UPDATE
} TrackerIndexType;
typedef enum {
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 Wed Aug 6 15:22:14 2008
@@ -535,9 +535,8 @@
TrackerLanguage *language;
TrackerHal *hal;
TrackerProcessor *processor;
- TrackerIndex *file_index;
- TrackerIndex *file_update_index;
- TrackerIndex *email_index;
+ TrackerIndex *index;
+ TrackerIndex *index_update;
TrackerRunningLevel runtime_level;
TrackerDBManagerFlags flags;
TrackerIndexManagerFlags iflags = 0;
@@ -722,18 +721,16 @@
return EXIT_FAILURE;
}
- file_index = tracker_index_manager_get_index (TRACKER_INDEX_TYPE_FILES);
- file_update_index = tracker_index_manager_get_index (TRACKER_INDEX_TYPE_FILES_UPDATE);
- email_index = tracker_index_manager_get_index (TRACKER_INDEX_TYPE_EMAILS);
-
- if (!TRACKER_IS_INDEX (file_index) ||
- !TRACKER_IS_INDEX (file_update_index) ||
- !TRACKER_IS_INDEX (email_index)) {
- g_critical ("Could not create indexer for all indexes (files, files-update, emails)");
+ index = tracker_index_manager_get_index (TRACKER_INDEX_TYPE_INDEX);
+ index_update = tracker_index_manager_get_index (TRACKER_INDEX_TYPE_INDEX_UPDATE);
+
+ if (!TRACKER_IS_INDEX (index) ||
+ !TRACKER_IS_INDEX (index_update)) {
+ g_critical ("Could not create indexer for all indexes (index, index-update)");
return EXIT_FAILURE;
}
- tracker_db_init (config, language, file_index);
+ tracker_db_init (config, language, index);
tracker_xesam_manager_init ();
processor = tracker_processor_new (config, hal);
@@ -746,8 +743,7 @@
/* Make Tracker available for introspection */
if (!tracker_dbus_register_objects (config,
language,
- file_index,
- email_index,
+ index,
processor)) {
return EXIT_FAILURE;
}
Modified: branches/indexer-split/src/trackerd/tracker-processor.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-processor.c (original)
+++ branches/indexer-split/src/trackerd/tracker-processor.c Wed Aug 6 15:22:14 2008
@@ -904,10 +904,7 @@
* module_name->index type so we don't do this for both
* every time:
*/
- index = tracker_index_manager_get_index (TRACKER_INDEX_TYPE_FILES);
- tracker_index_set_reload (index, TRUE);
-
- index = tracker_index_manager_get_index (TRACKER_INDEX_TYPE_EMAILS);
+ index = tracker_index_manager_get_index (TRACKER_INDEX_TYPE_INDEX);
tracker_index_set_reload (index, TRUE);
/* Message to the console about state */
@@ -953,10 +950,7 @@
* module_name->index type so we don't do this for both
* every time:
*/
- index = tracker_index_manager_get_index (TRACKER_INDEX_TYPE_FILES);
- tracker_index_set_reload (index, TRUE);
-
- index = tracker_index_manager_get_index (TRACKER_INDEX_TYPE_EMAILS);
+ index = tracker_index_manager_get_index (TRACKER_INDEX_TYPE_INDEX);
tracker_index_set_reload (index, TRUE);
/* Message to the console about state */
Modified: branches/indexer-split/src/trackerd/tracker-search.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-search.c (original)
+++ branches/indexer-split/src/trackerd/tracker-search.c Wed Aug 6 15:22:14 2008
@@ -51,8 +51,7 @@
TrackerConfig *config;
TrackerLanguage *language;
- TrackerIndex *file_index;
- TrackerIndex *email_index;
+ TrackerIndex *index;
} TrackerSearchPriv;
static void search_finalize (GObject *object);
@@ -87,8 +86,7 @@
g_object_unref (priv->fd_proxy);
}
- g_object_unref (priv->email_index);
- g_object_unref (priv->file_index);
+ g_object_unref (priv->index);
g_object_unref (priv->language);
g_object_unref (priv->config);
@@ -98,16 +96,14 @@
TrackerSearch *
tracker_search_new (TrackerConfig *config,
TrackerLanguage *language,
- TrackerIndex *file_index,
- TrackerIndex *email_index)
+ TrackerIndex *index)
{
TrackerSearch *object;
TrackerSearchPriv *priv;
g_return_val_if_fail (TRACKER_IS_CONFIG (config), NULL);
g_return_val_if_fail (TRACKER_IS_LANGUAGE (language), NULL);
- g_return_val_if_fail (TRACKER_IS_INDEX (file_index), NULL);
- g_return_val_if_fail (TRACKER_IS_INDEX (email_index), NULL);
+ g_return_val_if_fail (TRACKER_IS_INDEX (index), NULL);
object = g_object_new (TRACKER_TYPE_SEARCH, NULL);
@@ -115,8 +111,7 @@
priv->config = g_object_ref (config);
priv->language = g_object_ref (language);
- priv->file_index = g_object_ref (file_index);
- priv->email_index = g_object_ref (email_index);
+ priv->index = g_object_ref (index);
return object;
}
@@ -505,7 +500,7 @@
array = g_array_new (TRUE, TRUE, sizeof (gint));
g_array_append_vals (array, services, G_N_ELEMENTS (services));
tree = tracker_query_tree_new (search_text,
- priv->file_index,
+ priv->index,
priv->config,
priv->language,
array);
@@ -529,7 +524,6 @@
TrackerDBResultSet *result_set = NULL;
TrackerQueryTree *tree;
GArray *hit_counts;
- GArray *mail_hit_counts;
guint request_id;
guint i;
GPtrArray *values = NULL;
@@ -556,16 +550,12 @@
priv = GET_PRIV (object);
tree = tracker_query_tree_new (search_text,
- priv->file_index,
+ priv->index,
priv->config,
priv->language,
NULL);
hit_counts = tracker_query_tree_get_hit_counts (tree);
- tracker_query_tree_set_index (tree, priv->email_index);
- mail_hit_counts = tracker_query_tree_get_hit_counts (tree);
- g_array_append_vals (hit_counts, mail_hit_counts->data, mail_hit_counts->len);
- g_array_free (mail_hit_counts, TRUE);
for (i = 0; i < hit_counts->len; i++) {
TrackerHitCount count;
@@ -1248,7 +1238,7 @@
priv = GET_PRIV (object);
- value = tracker_index_get_suggestion (priv->file_index, search_text, max_dist);
+ value = tracker_index_get_suggestion (priv->index, search_text, max_dist);
if (!value) {
g_set_error (&actual_error,
Modified: branches/indexer-split/src/trackerd/tracker-search.h
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-search.h (original)
+++ branches/indexer-split/src/trackerd/tracker-search.h Wed Aug 6 15:22:14 2008
@@ -55,8 +55,7 @@
GType tracker_search_get_type (void);
TrackerSearch *tracker_search_new (TrackerConfig *config,
TrackerLanguage *language,
- TrackerIndex *file_index,
- TrackerIndex *email_index);
+ TrackerIndex *index);
void tracker_search_get_hit_count (TrackerSearch *object,
const gchar *service,
const gchar *search_text,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]