tracker r1679 - in branches/indexer-split: . data src/libtracker-common src/libtracker-db src/trackerd tests/trackerd tests/trackerd/xesam
- From: pvanhoof svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r1679 - in branches/indexer-split: . data src/libtracker-common src/libtracker-db src/trackerd tests/trackerd tests/trackerd/xesam
- Date: Fri, 13 Jun 2008 14:42:23 +0000 (UTC)
Author: pvanhoof
Date: Fri Jun 13 14:42:23 2008
New Revision: 1679
URL: http://svn.gnome.org/viewvc/tracker?rev=1679&view=rev
Log:
2008-06-13 Philip Van Hoof <pvanhoof gnome org>
* svn merge -r 1656:1678 ../xesam-support
Added:
branches/indexer-split/tests/trackerd/tracker-xesam-hit-test.c
- copied unchanged from r1678, /branches/xesam-support/tests/trackerd/tracker-xesam-hit-test.c
branches/indexer-split/tests/trackerd/tracker-xesam-hit-test.h
- copied unchanged from r1678, /branches/xesam-support/tests/trackerd/tracker-xesam-hit-test.h
branches/indexer-split/tests/trackerd/tracker-xesam-hits-test.c
- copied unchanged from r1678, /branches/xesam-support/tests/trackerd/tracker-xesam-hits-test.c
branches/indexer-split/tests/trackerd/tracker-xesam-hits-test.h
- copied unchanged from r1678, /branches/xesam-support/tests/trackerd/tracker-xesam-hits-test.h
branches/indexer-split/tests/trackerd/tracker-xesam-session-test.c
- copied unchanged from r1678, /branches/xesam-support/tests/trackerd/tracker-xesam-session-test.c
branches/indexer-split/tests/trackerd/tracker-xesam-session-test.h
- copied unchanged from r1678, /branches/xesam-support/tests/trackerd/tracker-xesam-session-test.h
branches/indexer-split/tests/trackerd/tracker-xesam-test.h
- copied unchanged from r1678, /branches/xesam-support/tests/trackerd/tracker-xesam-test.h
branches/indexer-split/tests/trackerd/xesam/
- copied from r1678, /branches/xesam-support/tests/trackerd/xesam/
Removed:
branches/indexer-split/src/libtracker-common/tracker-xesam-field.c
branches/indexer-split/src/libtracker-common/tracker-xesam-field.h
branches/indexer-split/src/libtracker-common/tracker-xesam-ontology.c
branches/indexer-split/src/libtracker-common/tracker-xesam-ontology.h
Modified:
branches/indexer-split/ChangeLog
branches/indexer-split/configure.ac
branches/indexer-split/data/sqlite-stored-procs.sql
branches/indexer-split/data/sqlite-xesam.sql
branches/indexer-split/src/libtracker-common/Makefile.am
branches/indexer-split/src/libtracker-common/tracker-field.h
branches/indexer-split/src/libtracker-db/tracker-db-manager.c
branches/indexer-split/src/trackerd/tracker-crawler.c
branches/indexer-split/src/trackerd/tracker-main.c
branches/indexer-split/src/trackerd/tracker-xesam-live-search.c
branches/indexer-split/tests/trackerd/Makefile.am
branches/indexer-split/tests/trackerd/tracker-xesam-test.c
Modified: branches/indexer-split/configure.ac
==============================================================================
--- branches/indexer-split/configure.ac (original)
+++ branches/indexer-split/configure.ac Fri Jun 13 14:42:23 2008
@@ -216,6 +216,8 @@
####################################################################
GLIB_WITH_UNIT_TESTING=2.15.0
+have_xesam_glib=no
+
AC_ARG_ENABLE(unit_tests,
AS_HELP_STRING([--enable-unit-tests=@<:@no/yes/auto@:>@],
[Enable unit tests (if available)]), ,
@@ -231,6 +233,8 @@
AC_PATH_PROG(GTESTER, [gtester], [no] )
if test "x$GTESTER" = "xno" ; then
AC_MSG_ERROR([*** Gtester is not in the path])
+ else
+ PKG_CHECK_MODULES(XESAM_GLIB, xesam-glib, [have_xesam_glib=yes], [have_xesam_glib=no])
fi
fi
else
@@ -238,12 +242,9 @@
glib_pkgconfig=
fi
-have_xesam_glib=no
if test "x$enable_unit_tests" = "xyes"; then
if test "x$have_unit_tests" != "xyes"; then
AC_MSG_ERROR([Couldn't find unit test compatible glib.])
- else
- PKG_CHECK_MODULES(XESAM_GLIB, xesam-glib, [have_xesam_glib=yes], [have_xesam_glib=no])
fi
fi
@@ -736,6 +737,7 @@
tests/Makefile
tests/libtracker-common/Makefile
tests/trackerd/Makefile
+ tests/trackerd/xesam/Makefile
src/xdgmime/Makefile
po/Makefile.in
python/Makefile
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 13 14:42:23 2008
@@ -201,14 +201,15 @@
InsertXesamServiceLookup REPLACE INTO XesamServiceLookup (XesamTypeName, TypeName) Values (?, ?);
InsertXesamMetaDataLookup REPLACE INTO XesamMetaDataLookup (XesamMetaName, MetaName) Values (?, ?);
-GetXesamServiceTypes SELECT TypeName, Parents FROM XesamServiceTypes;
+GetXesamServiceParents SELECT TypeName, Parents FROM XesamServiceTypes;
GetXesamServiceChildren SELECT Child FROM XesamServiceChildren WHERE Parent = ?;
GetXesamServiceMappings SELECT TypeName FROM XesamServiceMapping WHERE XesamTypeName = ?;
GetXesamServiceLookups SELECT DISTINCT TypeName FROM XesamServiceLookup WHERE XesamTypeName = ?;
-GetXesamMetaDataTypes SELECT MetaName, Parents FROM XesamMetaDataTypes;
+GetXesamMetaDataParents SELECT MetaName, Parents FROM XesamMetaDataTypes;
GetXesamMetaDataChildren SELECT Child FROM XesamMetaDataChildren WHERE Parent = ?;
GetXesamMetaDataMappings SELECT MetaName FROM XesamMetaDataMapping WHERE XesamMetaName = ?;
GetXesamMetaDataLookups SELECT DISTINCT MetaName FROM XesamMetaDataLookup WHERE XesamMetaName = ?;
-GetXesamMetadataTypes SELECT ID, MetaName, DataTypeID, Parents FROM XesamMetaDataTypes;
\ No newline at end of file
+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
Modified: branches/indexer-split/data/sqlite-xesam.sql
==============================================================================
--- branches/indexer-split/data/sqlite-xesam.sql (original)
+++ branches/indexer-split/data/sqlite-xesam.sql Fri Jun 13 14:42:23 2008
@@ -3,8 +3,24 @@
(
ID Integer primary key AUTOINCREMENT not null,
MetaName Text not null COLLATE NOCASE,
- DataTypeID Integer default 0, /* 0=string, 1=float, 2=integer, 3=boolean, 4=dateTime, 5=List of strings, 8=List of Uris, 9=List of Urls */
+ DataTypeID Integer default 0,
+ DisplayName text,
Description text default ' ',
+ Enabled integer default 1, /* used to prevent use of this metadata type */
+ UIVisible integer default 0, /* should this metadata type be visible in a search criteria UI */
+ WriteExec text default ' ', /* used to specify an external program that can write an *embedded* metadata to a file */
+ Alias text default ' ', /* alternate name for this type (XESAM specs?) */
+ FieldName text default ' ', /* filedname if present in the services table */
+ Weight Integer default 1, /* weight of metdata type in ranking */
+ Embedded Integer default 1, /* 1 if metadata extracted from the file by the indexer and is not updateable by the user. 0 - this metadata can be updated by the user and is external to the file */
+ MultipleValues Integer default 0, /* 0= type cannot have multiple values per entity, 1= type can have more than 1 value per entity */
+ Delimited Integer default 0, /* if 1, extra delimiters (hyphen and underscore) are used to break word */
+ Filtered Integer default 1, /* if 1, words are filtered for numerics (if numeric indexing is disabled), stopwords and min length */
+ Abstract Integer default 0, /* if 0, can be used for storing metadata - Abstract type classes cannot store metadata and can only be used for searching its decendants */
+ StemMetadata Integer default 1, /* 1 if metadata should be stemmed */
+ SideCar Integer default 0, /* should this metadata be backed up in an xmp sidecar file */
+ FileName Text default ' ',
+
Categories text default ' ',
Parents text default ' ',
@@ -15,7 +31,63 @@
(
TypeID Integer primary key AUTOINCREMENT not null,
TypeName Text COLLATE NOCASE not null,
+
+ TypeCount Integer default 0,
+
+ DisplayName Text default ' ',
+ Enabled Integer default 1,
+ Embedded Integer default 1, /* service is created by the indexer if embedded. User or app defined services are not embedded */
+ ChildResource Integer default 0, /* service is a child service */
+
+ CreateDesktopFile Integer default 0, /* used by a UI to indicate whether it should create a desktop file for the service if its copied (using the ViewerExec field + uri) */
+
+ /* useful for a UI when determining what actions a hit can have */
+ CanCopy Integer default 1,
+ CanDelete Integer default 1,
+
+ ShowServiceFiles Integer default 0,
+ ShowServiceDirectories Integer default 0,
+
+ HasMetadata Integer default 1,
+ HasFullText Integer default 1,
+ HasThumbs Integer default 1,
+
+ ContentMetadata Text default ' ', /* the content field is the one most likely to be used for showing a search snippet */
+
+ KeyMetadata1 Text default ' ', /* the most commonly requested metadata (especially for tables/grid views) is cached int he services table for extra fast retrieval */
+ KeyMetadata2 Text default ' ',
+ KeyMetadata3 Text default ' ',
+ KeyMetadata4 Text default ' ',
+ KeyMetadata5 Text default ' ',
+ KeyMetadata6 Text default ' ',
+ KeyMetadata7 Text default ' ',
+ KeyMetadata8 Text default ' ',
+ KeyMetadata9 Text default ' ',
+ KeyMetadata10 Text default ' ',
+ KeyMetadata11 Text default ' ',
+
+ UIVisible Integer default 0, /* should service appear in a search GUI? */
+ UITitle Text default ' ', /* title format as displayed in the metadata tile */
+ UIMetadata1 Text default ' ', /*UI fields to show in GUI for a hit - if not set then Name,Path,Mime are used */
+ UIMetadata2 Text default ' ',
+ UIMetadata3 Text default ' ',
+ UIView Text default 'default',
+
Description Text default ' ',
+ Database integer default 0, /* 0 = DB_FILES, 1 = DB_EMAILS, 2 = DB_MISC, 3 = DB_USER */
+ Icon Text default ' ',
+
+ IndexerExec Text default ' ',
+ IndexerOutput Text default 'stdout',
+ ThumbExec Text default ' ',
+ ViewerExec Text default ' ',
+
+ WatchFolders Text default ' ',
+ IncludeGlob Text default ' ',
+ ExcludeGlob Text default ' ',
+
+ FileName Text default ' ',
+
Parents text default ' ',
unique (TypeName)
Modified: branches/indexer-split/src/libtracker-common/Makefile.am
==============================================================================
--- branches/indexer-split/src/libtracker-common/Makefile.am (original)
+++ branches/indexer-split/src/libtracker-common/Makefile.am Fri Jun 13 14:42:23 2008
@@ -53,11 +53,7 @@
tracker-type-utils.c \
tracker-type-utils.h \
tracker-utils.c \
- tracker-utils.h \
- tracker-xesam-field.c \
- tracker-xesam-field.h \
- tracker-xesam-ontology.c \
- tracker-xesam-ontology.h
+ tracker-utils.h
libtracker_common_la_LDFLAGS = -version-info 0:0:0
libtracker_common_la_LIBADD = \
Modified: branches/indexer-split/src/libtracker-common/tracker-field.h
==============================================================================
--- branches/indexer-split/src/libtracker-common/tracker-field.h (original)
+++ branches/indexer-split/src/libtracker-common/tracker-field.h Fri Jun 13 14:42:23 2008
@@ -38,7 +38,7 @@
TRACKER_FIELD_TYPE_DATE,
TRACKER_FIELD_TYPE_BLOB,
TRACKER_FIELD_TYPE_STRUCT,
- TRACKER_FIELD_TYPE_LINK
+ TRACKER_FIELD_TYPE_LINK,
} TrackerFieldType;
GType tracker_field_type_get_type (void) G_GNUC_CONST;
Modified: branches/indexer-split/src/libtracker-db/tracker-db-manager.c
==============================================================================
--- branches/indexer-split/src/libtracker-db/tracker-db-manager.c (original)
+++ branches/indexer-split/src/libtracker-db/tracker-db-manager.c Fri Jun 13 14:42:23 2008
@@ -26,10 +26,8 @@
#include <zlib.h>
#include <libtracker-common/tracker-field.h>
-#include <libtracker-common/tracker-xesam-field.h>
#include <libtracker-common/tracker-nfs-lock.h>
#include <libtracker-common/tracker-ontology.h>
-#include <libtracker-common/tracker-xesam-ontology.h>
#include <libtracker-common/tracker-type-utils.h>
#include <libtracker-common/tracker-utils.h>
@@ -700,11 +698,48 @@
data_id = tracker_string_in_string_list (value, (gchar **) data_types);
if (data_id != -1) {
+ gint mapped_data_id;
+ gboolean list = FALSE;
+
+ /* We map these values to existing field types.
+ FIXME Eventually we should change the config file instead. */
+
+ switch (data_id) {
+ case 0:
+ mapped_data_id = TRACKER_FIELD_TYPE_STRING;
+ break;
+ case 1:
+ mapped_data_id = TRACKER_FIELD_TYPE_DOUBLE;
+ break;
+ case 2:
+ mapped_data_id = TRACKER_FIELD_TYPE_INTEGER;
+ break;
+ case 3:
+ mapped_data_id = TRACKER_FIELD_TYPE_INTEGER;
+ break;
+ case 4:
+ mapped_data_id = TRACKER_FIELD_TYPE_DATE;
+ break;
+ case 5:
+ case 6:
+ case 7:
+ list = TRUE;
+ mapped_data_id = TRACKER_FIELD_TYPE_STRING;
+ break;
+ }
+
sql = g_strdup_printf ("update XesamMetadataTypes set DataTypeID = %d where ID = %s",
- data_id,
+ mapped_data_id,
str_id);
db_exec_no_reply (iface, sql);
g_free (sql);
+
+ if (list) {
+ sql = g_strdup_printf ("update XesamMetadataTypes set MultipleValues = 1 where ID = %s",
+ str_id);
+ db_exec_no_reply (iface, sql);
+ g_free (sql);
+ }
}
} else {
load_service_file_xesam_update (iface,
@@ -951,107 +986,6 @@
return service;
}
-static TrackerXesamField *
-db_row_to_xesam_field_def (TrackerDBResultSet *result_set)
-{
- TrackerXesamField *field_def;
- TrackerFieldType field_type;
- gchar *id_str, *name;
- gint id;
-
- field_def = tracker_xesam_field_new ();
-
- tracker_db_result_set_get (result_set,
- 0, &id,
- 1, &name,
- 2, &field_type,
- -1);
-
- id_str = tracker_int_to_string (id);
-
- tracker_xesam_field_set_id (field_def, id_str);
- tracker_xesam_field_set_name (field_def, name);
- tracker_xesam_field_set_data_type (field_def, field_type);
-
- g_free (id_str);
- g_free (name);
-
- return field_def;
-}
-
-static TrackerService *
-db_row_to_xesam_service (TrackerDBResultSet *result_set)
-{
- TrackerService *service;
- GSList *new_list = NULL;
- gint id, i;
- gchar *name, *parent, *content_metadata;
- gboolean enabled, embedded, has_metadata, has_fulltext;
- gboolean has_thumbs, show_service_files, show_service_directories;
-
- service = tracker_service_new ();
-
- tracker_db_result_set_get (result_set,
- 0, &id,
- 1, &name,
- 2, &parent,
- 3, &enabled,
- 4, &embedded,
- 5, &has_metadata,
- 6, &has_fulltext,
- 7, &has_thumbs,
- 8, &content_metadata,
- 10, &show_service_files,
- 11, &show_service_directories,
- -1);
-
- tracker_service_set_id (service, id);
- tracker_service_set_name (service, name);
- tracker_service_set_parent (service, parent);
- tracker_service_set_enabled (service, enabled);
- tracker_service_set_embedded (service, embedded);
- tracker_service_set_has_metadata (service, has_metadata);
- tracker_service_set_has_full_text (service, has_fulltext);
- tracker_service_set_has_thumbs (service, has_thumbs);
- tracker_service_set_content_metadata (service, content_metadata);
-
- tracker_service_set_show_service_files (service, show_service_files);
- tracker_service_set_show_service_directories (service, show_service_directories);
-
- for (i = 12; i < 23; i++) {
- gchar *metadata;
-
- tracker_db_result_set_get (result_set, i, &metadata, -1);
-
- if (metadata) {
- new_list = g_slist_prepend (new_list, metadata);
- }
- }
-
- /* FIXME: is this necessary? */
-#if 0
- /* Hack to prevent db change late in the cycle, check the
- * service name matches "Applications", then add some voodoo.
- */
- if (strcmp (name, "Applications") == 0) {
- /* These strings should be definitions at the top of
- * this file somewhere really.
- */
- new_list = g_slist_prepend (new_list, g_strdup ("App:DisplayName"));
- new_list = g_slist_prepend (new_list, g_strdup ("App:Exec"));
- new_list = g_slist_prepend (new_list, g_strdup ("App:Icon"));
- }
-#endif
-
- new_list = g_slist_reverse (new_list);
-
- tracker_service_set_key_metadata (service, new_list);
- g_slist_foreach (new_list, (GFunc) g_free, NULL);
- g_slist_free (new_list);
-
- return service;
-}
-
static GSList *
db_mime_query (TrackerDBInterface *iface,
const gchar *stored_proc,
@@ -1612,22 +1546,22 @@
/* Get static xesam metadata info */
result_set = tracker_db_interface_execute_procedure (iface,
NULL,
- "GetXesamMetadataTypes",
+ "GetXesamMetaDataTypes",
NULL);
if (result_set) {
gboolean valid = TRUE;
while (valid) {
- TrackerXesamField *def;
+ TrackerField *def;
- def = db_row_to_xesam_field_def (result_set);
+ def = db_row_to_field_def (result_set);
g_message ("Loading xesam metadata def:'%s' with type:%d",
- tracker_xesam_field_get_name (def),
- tracker_xesam_field_get_data_type (def));
+ tracker_field_get_name (def),
+ tracker_field_get_data_type (def));
- tracker_xesam_ontology_add_field (def);
+ tracker_ontology_add_field (def);
valid = tracker_db_result_set_iter_next (result_set);
}
@@ -1638,7 +1572,7 @@
/* Get static xesam service info */
result_set = tracker_db_interface_execute_procedure (iface,
NULL,
- "GetAllServices",
+ "GetXesamServiceTypes",
NULL);
if (result_set) {
@@ -1667,9 +1601,9 @@
id,
g_slist_length (mimes));
- tracker_xesam_ontology_add_service_type (service,
- mimes,
- mime_prefixes);
+ tracker_ontology_add_service_type (service,
+ mimes,
+ mime_prefixes);
g_slist_free (mimes);
g_slist_free (mime_prefixes);
@@ -2011,7 +1945,7 @@
valid = TRUE;
result_set = db_exec_proc (iface,
- "GetXesamServiceTypes",
+ "GetXesamServiceParents",
NULL);
if (result_set) {
@@ -2046,7 +1980,7 @@
valid = TRUE;
result_set = db_exec_proc (iface,
- "GetXesamMetaDataTypes",
+ "GetXesamMetaDataParents",
NULL);
if (result_set) {
Modified: branches/indexer-split/src/trackerd/tracker-crawler.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-crawler.c (original)
+++ branches/indexer-split/src/trackerd/tracker-crawler.c Fri Jun 13 14:42:23 2008
@@ -731,14 +731,54 @@
crawler);
}
+static void
+on_process_files_cb (DBusGProxy *proxy, GError *error, gpointer user_data)
+{
+ GStrv files = user_data;
+
+ if (error) {
+ g_critical ("Could not send %d files to indexer to process, %s",
+ g_strv_length (files),
+ error->message);
+ g_clear_error (&error);
+ } else {
+ g_debug ("Sent!");
+ }
+
+ g_strfreev (files);
+}
+
+static void
+on_get_running (DBusGProxy *proxy, gboolean running, GError *error, gpointer user_data)
+{
+ TrackerCrawler *crawler = user_data;
+ gchar ** files;
+
+ if (!error && running) {
+ g_debug ("Processing file queue...");
+ files = tracker_dbus_async_queue_to_strv (crawler->priv->files,
+ FILES_QUEUE_PROCESS_MAX);
+
+ g_debug ("Sending %d files to indexer to process", g_strv_length (files));
+
+ org_freedesktop_Tracker_Indexer_process_files_async (proxy,
+ (const gchar **) files,
+ on_process_files_cb,
+ files);
+
+ } else {
+ g_message ("Couldn't process files, %s",
+ error ? error->message : "indexer not running");
+ }
+
+ g_object_unref (crawler);
+}
+
static gboolean
file_queue_handle_cb (gpointer user_data)
{
TrackerCrawler *crawler;
DBusGProxy *proxy;
- GError *error;
- gchar ** files;
- gboolean running;
gint length;
crawler = user_data;
@@ -751,37 +791,10 @@
/* Check we can actually talk to the indexer */
proxy = tracker_dbus_indexer_get_proxy ();
- error = NULL;
-
- org_freedesktop_Tracker_Indexer_get_running (proxy,
- &running,
- &error);
- if (error || !running) {
- g_message ("Couldn't process files, %s",
- error ? error->message : "indexer not running");
- g_clear_error (&error);
- return TRUE;
- }
-
- g_debug ("Processing file queue...");
- files = tracker_dbus_async_queue_to_strv (crawler->priv->files,
- FILES_QUEUE_PROCESS_MAX);
- g_debug ("Sending %d files to indexer to process", g_strv_length (files));
- org_freedesktop_Tracker_Indexer_process_files (proxy,
- (const gchar **) files,
- &error);
-
- if (error) {
- g_critical ("Could not send %d files to indexer to process, %s",
- g_strv_length (files),
- error->message);
- g_clear_error (&error);
- } else {
- g_debug ("Sent!");
- }
-
- g_strfreev (files);
+ org_freedesktop_Tracker_Indexer_get_running_async (proxy,
+ on_get_running,
+ g_object_ref (crawler));
return TRUE;
}
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 Fri Jun 13 14:42:23 2008
@@ -826,7 +826,6 @@
tracker_nfs_lock_init (tracker_config_get_nfs_locking (tracker->config));
tracker_ontology_init ();
- tracker_xesam_ontology_init ();
tracker_db_init ();
tracker_db_manager_init (TRUE, data_dir, user_data_dir, sys_tmp_dir); /* Using TRUE=broken */
tracker_xesam_manager_init ();
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 13 14:42:23 2008
@@ -24,8 +24,6 @@
#include <dbus/dbus-glib-bindings.h>
#include "tracker-xesam-live-search.h"
-#include <libtracker-common/tracker-xesam-field.h>
-#include <libtracker-common/tracker-xesam-ontology.h>
#include "tracker-xesam.h"
#include "tracker-xesam-manager.h"
#include "tracker-xesam-query.h"
@@ -535,7 +533,6 @@
}
}
-
typedef struct {
gint key;
gpointer value;
@@ -629,13 +626,14 @@
field_count = g_strv_length (fields);
while (valid) {
+
guint column;
GPtrArray *row;
GValue value_in = {0, };
gboolean insert = FALSE;
gint key;
- TrackerXesamFieldType data_type;
- TrackerXesamField *field_def;
+ TrackerFieldType data_type;
+ TrackerField *field_def;
_tracker_db_result_set_get_value (result_set, 0, &value_in);
@@ -682,104 +680,78 @@
column,
&cur_value);
- field_def = tracker_xesam_ontology_get_field_def (fields[column-1]);
- data_type = tracker_xesam_field_get_data_type (field_def);
+ field_def = tracker_ontology_get_field_def (fields[column-1]);
+ data_type = tracker_field_get_data_type (field_def);
+
+ if (tracker_field_get_multiple_values (field_def)) {
- switch (data_type) {
- case TRACKER_XESAM_FIELD_TYPE_LIST_OF_URLS:
- case TRACKER_XESAM_FIELD_TYPE_LIST_OF_URIS:
- case TRACKER_XESAM_FIELD_TYPE_LIST_OF_DATETIMES:
- case TRACKER_XESAM_FIELD_TYPE_LIST_OF_STRINGS: {
+ switch (data_type) {
+ case TRACKER_FIELD_TYPE_DATE:
+ case TRACKER_FIELD_TYPE_STRING: {
GValue *variant;
GPtrArray *my_array;
-
+
if (row->len <= (unsigned int) column) {
variant = g_new0 (GValue, 1);
g_value_init (variant,
dbus_g_type_get_collection ("GPtrArray",
- G_TYPE_STRING));
-
+ G_TYPE_STRING));
+
my_array = g_ptr_array_new ();
g_value_set_boxed_take_ownership (variant,
my_array);
-
+
g_ptr_array_add (row, variant);
-
+
} else {
- variant = g_ptr_array_index (row, column);
+ variant = g_ptr_array_index (row, column-1);
my_array = g_value_get_boxed (variant);
}
-
+
g_ptr_array_add (my_array,
- g_value_dup_string (&cur_value));
-
- }
- break;
-
- case TRACKER_XESAM_FIELD_TYPE_LIST_OF_FLOATS: {
- GValue *variant;
- GArray *my_array;
- gfloat float_val;
-
- if (row->len <= (unsigned int) column) {
- variant = g_new0 (GValue, 1);
- g_value_init (variant,
- dbus_g_type_get_collection ("GArray",
- G_TYPE_FLOAT));
-
- my_array = g_array_new (FALSE,
- TRUE,
- sizeof (gfloat));
- g_value_set_boxed_take_ownership (variant, my_array);
-
- g_ptr_array_add (row, variant);
- } else {
- variant = g_ptr_array_index (row, column);
- my_array = g_value_get_boxed (variant);
- }
-
- float_val = g_value_get_float (&cur_value);
- g_array_append_val (my_array, float_val);
+ g_value_dup_string (&cur_value));
+
+ break;
}
- break;
- case TRACKER_XESAM_FIELD_TYPE_LIST_OF_INTEGERS: {
+ case TRACKER_FIELD_TYPE_INTEGER: {
GValue *variant;
GArray *my_array;
gint int_val;
-
+
if (row->len <= (unsigned int) column) {
variant = g_new0 (GValue, 1);
g_value_init (variant,
dbus_g_type_get_collection ("GArray",
- G_TYPE_INT));
-
+ G_TYPE_INT));
+
my_array = g_array_new (FALSE,
TRUE,
- sizeof (gint));
+ sizeof (gfloat));
g_value_set_boxed_take_ownership (variant, my_array);
-
+
g_ptr_array_add (row, variant);
} else {
variant = g_ptr_array_index (row, column);
my_array = g_value_get_boxed (variant);
}
-
+
int_val = g_value_get_int (&cur_value);
- g_array_append_val (my_array, int_val);
- }
- break;
+ g_array_append_val (my_array, int_val);
- case TRACKER_XESAM_FIELD_TYPE_LIST_OF_BOOLEANS: {
- GValue *variant;
- GArray *my_array;
- gboolean bool_val;
+ break;
+ }
+ case TRACKER_FIELD_TYPE_DOUBLE: {
+ GValue *variant;
+ GArray *my_array;
+ gfloat float_val;
+
if (row->len <= (unsigned int) column) {
variant = g_new0 (GValue, 1);
g_value_init (variant,
dbus_g_type_get_collection ("GArray",
- G_TYPE_BOOLEAN));
+ G_TYPE_FLOAT));
my_array = g_array_new (FALSE,
TRUE,
@@ -792,39 +764,35 @@
my_array = g_value_get_boxed (variant);
}
- bool_val = g_value_get_boolean (&cur_value);
- g_array_append_val (my_array, bool_val);
+ float_val = g_value_get_float (&cur_value);
+ g_array_append_val (my_array, float_val);
}
break;
-
- case TRACKER_XESAM_FIELD_TYPE_STRING:
- case TRACKER_XESAM_FIELD_TYPE_FLOAT:
- case TRACKER_XESAM_FIELD_TYPE_INTEGER:
- case TRACKER_XESAM_FIELD_TYPE_BOOLEAN:
- case TRACKER_XESAM_FIELD_TYPE_DATE:
- default: {
- if (insert) {
- GValue *value = g_new0 (GValue, 1);
-
- g_value_init (value,
- G_VALUE_TYPE (&cur_value));
-
- g_value_copy (&cur_value, value);
- g_ptr_array_add (row, value);
- }
-
- /* Else it's a redundant cell (a previous
- * loop-cycle has added this item to the
- * final to-return result already, using
- * the top-row). */
+ default:
+ g_warning ("Unknown type in get_hits: %d", data_type);
}
- break;
+ } else {
+ if (insert) {
+ GValue *value = g_new0 (GValue, 1);
+
+ g_value_init (value,
+ G_VALUE_TYPE (&cur_value));
+
+ g_value_copy (&cur_value, value);
+ g_ptr_array_add (row, value);
+ }
+
+ /* Else it's a redundant cell (a previous
+ * loop-cycle has added this item to the
+ * final to-return result already, using
+ * the top-row). */
+
}
g_value_unset (&cur_value);
}
-
-
+
+
if (insert) {
rows_insert (rows, key, row);
}
@@ -864,8 +832,6 @@
g_return_if_fail (TRACKER_IS_XESAM_LIVE_SEARCH (self));
g_return_if_fail (hits != NULL);
- g_debug ("Get_hits called");
-
priv = self->priv;
if (!priv->active)
@@ -950,8 +916,6 @@
iface = tracker_db_manager_get_db_interface (TRACKER_DB_XESAM);
- g_debug ("live_search_get_range_hits");
-
tracker_xesam_session_get_property (session,
"hit.fields",
&value,
@@ -1147,8 +1111,6 @@
TrackerDBInterface *iface;
GArray *hits;
- g_debug ("* * * Activate");
-
iface = tracker_db_manager_get_db_interface (TRACKER_DB_XESAM);
tracker_db_live_search_start (iface,
Modified: branches/indexer-split/tests/trackerd/Makefile.am
==============================================================================
--- branches/indexer-split/tests/trackerd/Makefile.am (original)
+++ branches/indexer-split/tests/trackerd/Makefile.am Fri Jun 13 14:42:23 2008
@@ -1,32 +1,40 @@
+SUBDIRS = xesam .
+
include $(top_srcdir)/Makefile.decl
noinst_PROGRAMS = $(TEST_PROGS)
+INCLUDES = \
+ -g \
+ -DG_LOG_DOMAIN=\"Tracker\" \
+ -I$(top_srcdir)/src \
+ $(GMODULE_CFLAGS) \
+ $(GTHREAD_CFLAGS) \
+ $(GLIB2_CFLAGS) \
+ $(DBUS_CFLAGS)
+
if HAVE_XESAM_GLIB
-TEST_PROGS += tracker-xesam
-else
-TEST_PROGS =
-endif
-INCLUDES = \
- -g \
- -DG_LOG_DOMAIN=\"Tracker\" \
- -I$(top_srcdir)/src \
- $(GMODULE_CFLAGS) \
- $(GTHREAD_CFLAGS) \
- $(GLIB2_CFLAGS)
+TEST_PROGS += tracker-xesam
-if HAVE_XESAM_GLIB
INCLUDES += $(XESAM_GLIB_CFLAGS)
tracker_xesam_SOURCES = \
- tracker-xesam-test.c
+ tracker-xesam-test.c \
+ tracker-xesam-session-test.c \
+ tracker-xesam-session-test.h \
+ tracker-xesam-hit-test.c \
+ tracker-xesam-hit-test.h \
+ tracker-xesam-hits-test.c \
+ tracker-xesam-hits-test.h
+
+tracker_xesam_LDADD = \
+ $(top_builddir)/tests/trackerd/xesam/libxesamhelper.la \
+ $(XESAM_GLIB_LIBS) \
+ $(GMODULE_LIBS) \
+ $(GTHREAD_LIBS) \
+ $(GLIB2_LIBS) \
+ $(DBUS_LIBS)
-tracker_xesam_LDADD = \
- $(XESAM_GLIB_LIBS) \
- $(top_builddir)/src/libtracker-common/libtracker-common.la \
- $(GMODULE_LIBS) \
- $(GTHREAD_LIBS) \
- $(GLIB2_LIBS)
endif
Modified: branches/indexer-split/tests/trackerd/tracker-xesam-test.c
==============================================================================
--- branches/indexer-split/tests/trackerd/tracker-xesam-test.c (original)
+++ branches/indexer-split/tests/trackerd/tracker-xesam-test.c Fri Jun 13 14:42:23 2008
@@ -1,19 +1,45 @@
#include <glib.h>
#include <glib/gtestutils.h>
+#include <dbus/dbus-glib-bindings.h>
+
+#include "tracker-xesam-session-test.h"
+#include "tracker-xesam-hits-test.h"
+#include "tracker-xesam-hit-test.h"
+
+#include "tracker-xesam-test.h"
+
+/*
+ * This is a hack to initialize the dbus glib specialized types.
+ * See bug https://bugs.freedesktop.org/show_bug.cgi?id=13908
+ */
+static void
+init_dbus_glib_types (void)
+{
+ DBusGConnection *connection;
+ GError *error;
+ error = NULL;
+ connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+ dbus_g_connection_unref (connection);
+}
int
main (int argc, char **argv) {
- int result;
+ int result;
g_type_init ();
g_test_init (&argc, &argv, NULL);
-// g_test_add_func ("/trackerd/tracker-services/get_id_for_service",
-// test_get_id_for_service);
+ init_dbus_glib_types();
+
+ g_test_bug_base ("http://bugzilla.gnome.org/");
+
+ g_test_add_session_tests ();
+ g_test_add_hit_tests ();
+ g_test_add_hits_tests ();
+
+ result = g_test_run ();
- result = g_test_run ();
-
- return result;
+ return result;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]