[tracker/tracker-0.6] Add a generic dbus method for performing aggregates on unique value queries.
- From: Mikael Ottela <mottela src gnome org>
- To: svn-commits-list gnome org
- Subject: [tracker/tracker-0.6] Add a generic dbus method for performing aggregates on unique value queries.
- Date: Tue, 5 May 2009 23:00:33 -0400 (EDT)
commit 42d15a9a7131ac47623044823bdcbc960b77522d
Author: Mikael Ottela <mikael ottela ixonos com>
Date: Wed May 6 05:57:05 2009 +0300
Add a generic dbus method for performing aggregates on unique value queries.
A more generic method has been added for aggregates on unique values.
---
data/dbus/tracker-metadata.xml | 13 ++
src/libtracker-data/tracker-data-search.c | 293 +++++++++++++++++++++++++++++
src/libtracker-data/tracker-data-search.h | 10 +
src/libtracker/tracker.c | 28 +++
src/libtracker/tracker.h | 3 +
src/tracker-utils/tracker-unique.c | 92 ++++++++--
src/trackerd/tracker-metadata.c | 60 ++++++
src/trackerd/tracker-metadata.h | 11 +
8 files changed, 493 insertions(+), 17 deletions(-)
diff --git a/data/dbus/tracker-metadata.xml b/data/dbus/tracker-metadata.xml
index 7a8da82..eb49a50 100644
--- a/data/dbus/tracker-metadata.xml
+++ b/data/dbus/tracker-metadata.xml
@@ -144,5 +144,18 @@
<arg type="aas" name="result" direction="out" />
</method>
+ <method name="GetUniqueValuesWithAggregates">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/>
+ <arg type="s" name="service" direction="in" />
+ <arg type="as" name="meta_types" direction="in" />
+ <arg type="s" name="query" direction="in" />
+ <arg type="as" name="aggregates" direction="in" />
+ <arg type="as" name="aggregate_fields" direction="in" />
+ <arg type="b" name="descending" direction="in" />
+ <arg type="i" name="offset" direction="in" />
+ <arg type="i" name="max_hits" direction="in" />
+ <arg type="aas" name="result" direction="out" />
+ </method>
+
</interface>
</node>
diff --git a/src/libtracker-data/tracker-data-search.c b/src/libtracker-data/tracker-data-search.c
index 1c2b0ba..8eb2605 100644
--- a/src/libtracker-data/tracker-data-search.c
+++ b/src/libtracker-data/tracker-data-search.c
@@ -1225,6 +1225,299 @@ tracker_data_search_get_count (const gchar *service_type,
}
TrackerDBResultSet *
+tracker_data_search_get_unique_values_with_aggregates (const gchar *service_type,
+ gchar **fields,
+ const gchar *query_condition,
+ gchar **aggregates,
+ gchar **aggregate_fields,
+ gboolean order_desc,
+ gint offset,
+ gint max_hits,
+ GError **error)
+{
+ TrackerDBInterface *iface;
+ TrackerDBResultSet *result_set = NULL;
+
+ GSList *field_list = NULL;
+ gchar *str_offset, *str_limit;
+
+ GString *sql_select;
+ GString *sql_from;
+ GString *sql_where;
+ GString *sql_order;
+ GString *sql_group;
+ gchar *sql;
+
+ gchar *rdf_where;
+ gchar *rdf_from;
+ GError *actual_error = NULL;
+
+ guint i;
+
+ g_return_val_if_fail (service_type != NULL, NULL);
+ g_return_val_if_fail (fields != NULL, NULL);
+ g_return_val_if_fail (query_condition != NULL, NULL);
+
+ if (!tracker_ontology_service_is_valid (service_type)) {
+ g_set_error (error, TRACKER_DBUS_ERROR, 0,
+ "Service_Type '%s' is invalid or has not been implemented yet",
+ service_type);
+ return NULL;
+ }
+
+ if (g_strv_length (aggregates) != g_strv_length (aggregate_fields)) {
+ g_set_error (error, TRACKER_DBUS_ERROR, 0,
+ "The number of aggregates and aggregate fields do not match");
+ return NULL;
+ }
+
+ iface = tracker_db_manager_get_db_interface_by_service (service_type);
+
+ sql_select = g_string_new ("SELECT DISTINCT ");
+ sql_from = g_string_new ("\nFROM Services AS S ");
+ sql_where = g_string_new ("\nWHERE ");
+ sql_order = g_string_new ("");
+ sql_group = g_string_new ("\nGROUP BY ");
+
+
+ for (i = 0; i < g_strv_length (fields); i++) {
+ TrackerFieldData *fd;
+
+ fd = tracker_metadata_add_metadata_field (iface, service_type, &field_list, fields[i], TRUE, FALSE, TRUE);
+
+ if (!fd) {
+ g_string_free (sql_select, TRUE);
+ g_string_free (sql_from, TRUE);
+ g_string_free (sql_where, TRUE);
+ g_string_free (sql_order, TRUE);
+ g_string_free (sql_group, TRUE);
+
+ g_slist_foreach (field_list, (GFunc) g_object_unref, NULL);
+ g_slist_free (field_list);
+
+ g_set_error (error, TRACKER_DBUS_ERROR, 0,
+ "Invalid or non-existant metadata type '%s' specified",
+ fields[i]);
+ return NULL;
+ }
+
+ if (i) {
+ g_string_append_printf (sql_select, ",");
+ g_string_append_printf (sql_group, ",");
+ }
+
+ g_string_append_printf (sql_select, "%s", tracker_field_data_get_select_field (fd));
+ if (order_desc) {
+ if (i) {
+ g_string_append_printf (sql_order, ",");
+ }
+ g_string_append_printf (sql_order, "\nORDER BY %s DESC ",
+ tracker_field_data_get_order_field (fd));
+ }
+ g_string_append_printf (sql_group, "%s", tracker_field_data_get_order_field (fd));
+
+ }
+
+ for (i = 0; i < g_strv_length (aggregates); i++) {
+ if (strcmp (aggregates[i],"COUNT") == 0) {
+ if (!(tracker_is_empty_string (aggregate_fields[i]))) {
+ TrackerFieldData *fd;
+
+ if (strcmp (aggregate_fields[i], "*")) {
+ fd = tracker_metadata_add_metadata_field (iface, service_type,
+ &field_list, aggregate_fields[i],
+ TRUE, FALSE, FALSE);
+
+ if (!fd) {
+ g_string_free (sql_select, TRUE);
+ g_string_free (sql_from, TRUE);
+ g_string_free (sql_where, TRUE);
+ g_string_free (sql_order, TRUE);
+ g_string_free (sql_group, TRUE);
+
+ g_slist_foreach (field_list, (GFunc) g_object_unref, NULL);
+ g_slist_free (field_list);
+
+ g_set_error (error, TRACKER_DBUS_ERROR, 0,
+ "Invalid or non-existant metadata type '%s' specified",
+ aggregate_fields[i]);
+ return NULL;
+ }
+
+ g_string_append_printf (sql_select, ", COUNT (DISTINCT %s)",
+ tracker_field_data_get_select_field (fd));
+ } else {
+ g_string_append_printf (sql_select, ", COUNT (DISTINCT S.ID)");
+ }
+ }
+ } else if (strcmp (aggregates[i], "SUM") == 0) {
+ if ( !(tracker_is_empty_string (aggregate_fields[i])) ) {
+ TrackerFieldData *fd;
+ TrackerFieldType data_type;
+
+ fd = tracker_metadata_add_metadata_field (iface, service_type,
+ &field_list, aggregate_fields[i],
+ TRUE, FALSE, FALSE);
+
+ if (!fd) {
+ g_string_free (sql_select, TRUE);
+ g_string_free (sql_from, TRUE);
+ g_string_free (sql_where, TRUE);
+ g_string_free (sql_order, TRUE);
+ g_string_free (sql_group, TRUE);
+
+ g_slist_foreach (field_list, (GFunc) g_object_unref, NULL);
+ g_slist_free (field_list);
+
+ g_set_error (error, TRACKER_DBUS_ERROR, 0,
+ "Invalid or non-existant metadata type '%s' specified",
+ aggregate_fields[i]);
+ return NULL;
+ }
+
+ data_type = tracker_field_data_get_data_type (fd);
+
+ if (!is_data_type_numeric (data_type)) {
+ g_string_free (sql_select, TRUE);
+ g_string_free (sql_from, TRUE);
+ g_string_free (sql_where, TRUE);
+ g_string_free (sql_order, TRUE);
+ g_string_free (sql_group, TRUE);
+
+ g_slist_foreach (field_list, (GFunc) g_object_unref, NULL);
+ g_slist_free (field_list);
+
+ g_set_error (error, TRACKER_DBUS_ERROR, 0,
+ "Cannot sum '%s': this metadata type is not numeric",
+ aggregate_fields[i]);
+ return NULL;
+ }
+
+ g_string_append_printf (sql_select, ", SUM (%s)",
+ tracker_field_data_get_select_field (fd));
+ }
+ } else if (strcmp (aggregates[i], "CONCAT") == 0 ) {
+ if (!(tracker_is_empty_string (aggregate_fields[i]))) {
+ TrackerFieldData *fd;
+ TrackerFieldType data_type;
+
+ fd = tracker_metadata_add_metadata_field (iface, service_type,
+ &field_list, aggregate_fields[i],
+ TRUE, FALSE, FALSE);
+
+ if (!fd) {
+ g_string_free (sql_select, TRUE);
+ g_string_free (sql_from, TRUE);
+ g_string_free (sql_where, TRUE);
+ g_string_free (sql_order, TRUE);
+ g_string_free (sql_group, TRUE);
+
+ g_slist_foreach (field_list, (GFunc) g_object_unref, NULL);
+ g_slist_free (field_list);
+
+ g_set_error (error, TRACKER_DBUS_ERROR, 0,
+ "Invalid or non-existant metadata type '%s' specified",
+ aggregate_fields[i]);
+ return NULL;
+ }
+
+ data_type = tracker_field_data_get_data_type (fd);
+
+ if (!is_data_type_text (data_type)) {
+ g_string_free (sql_select, TRUE);
+ g_string_free (sql_from, TRUE);
+ g_string_free (sql_where, TRUE);
+ g_string_free (sql_order, TRUE);
+ g_string_free (sql_group, TRUE);
+
+ g_slist_foreach (field_list, (GFunc) g_object_unref, NULL);
+ g_slist_free (field_list);
+
+ g_set_error (error, TRACKER_DBUS_ERROR, 0,
+ "Cannot concatenate '%s': this metadata type is not text",
+ aggregate_fields[i]);
+ return NULL;
+ }
+
+ g_string_append_printf (sql_select, ", GROUP_CONCAT (DISTINCT %s)",
+ tracker_field_data_get_select_field (fd));
+ }
+ } else {
+ g_string_free (sql_select, TRUE);
+ g_string_free (sql_from, TRUE);
+ g_string_free (sql_where, TRUE);
+ g_string_free (sql_order, TRUE);
+ g_string_free (sql_group, TRUE);
+
+ g_slist_foreach (field_list, (GFunc) g_object_unref, NULL);
+ g_slist_free (field_list);
+
+ g_debug ("Got an unknown operation %s", aggregates[i]);
+
+ g_set_error (error, TRACKER_DBUS_ERROR, 0,
+ "Aggregate operation %s not found",
+ aggregates[i]);
+ return NULL;
+ }
+ }
+
+ tracker_rdf_filter_to_sql (iface, query_condition, service_type,
+ &field_list, &rdf_from, &rdf_where, &actual_error);
+
+ if (actual_error) {
+ g_string_free (sql_select, TRUE);
+ g_string_free (sql_from, TRUE);
+ g_string_free (sql_where, TRUE);
+ g_string_free (sql_order, TRUE);
+ g_string_free (sql_group, TRUE);
+
+ g_slist_foreach (field_list, (GFunc) g_object_unref, NULL);
+ g_slist_free (field_list);
+
+ g_propagate_error (error, actual_error);
+
+ return NULL;
+ }
+
+ g_string_append_printf (sql_from, " %s ", rdf_from);
+ g_string_append_printf (sql_where, " %s ", rdf_where);
+
+ g_free (rdf_from);
+ g_free (rdf_where);
+
+ str_offset = tracker_gint_to_string (offset);
+ str_limit = tracker_gint_to_string (metadata_sanity_check_max_hits (max_hits));
+
+ g_string_append_printf (sql_order, " LIMIT %s,%s", str_offset, str_limit);
+
+ sql = g_strconcat (sql_select->str, " ",
+ sql_from->str, " ",
+ sql_where->str, " ",
+ sql_group->str, " ",
+ sql_order->str, NULL);
+
+ g_free (str_offset);
+ g_free (str_limit);
+
+ g_string_free (sql_select, TRUE);
+ g_string_free (sql_from, TRUE);
+ g_string_free (sql_where, TRUE);
+ g_string_free (sql_order, TRUE);
+ g_string_free (sql_group, TRUE);
+
+ g_slist_foreach (field_list, (GFunc) g_object_unref, NULL);
+ g_slist_free (field_list);
+
+ g_message ("Unique values query executed:\n%s", sql);
+
+ result_set = tracker_db_interface_execute_query (iface, NULL, "%s", sql);
+
+ g_free (sql);
+
+ return result_set;
+}
+
+TrackerDBResultSet *
tracker_data_search_metadata_in_path (const gchar *path,
gchar **fields,
GError **error)
diff --git a/src/libtracker-data/tracker-data-search.h b/src/libtracker-data/tracker-data-search.h
index 50dcca2..cd72138 100644
--- a/src/libtracker-data/tracker-data-search.h
+++ b/src/libtracker-data/tracker-data-search.h
@@ -121,6 +121,16 @@ TrackerDBResultSet *tracker_data_search_get_unique_values_with_concat_count_and_
gint max_hits,
GError **error);
+TrackerDBResultSet *tracker_data_search_get_unique_values_with_aggregates (const gchar *service_type,
+ gchar **fields,
+ const gchar *query_condition,
+ gchar **aggregates,
+ gchar **aggregate_fields,
+ gboolean order_desc,
+ gint offset,
+ gint max_hits,
+ GError **error);
+
TrackerDBResultSet *tracker_data_search_metadata_in_path (const gchar *path,
gchar **fields,
GError **error);
diff --git a/src/libtracker/tracker.c b/src/libtracker/tracker.c
index 8a3a729..4b2074e 100644
--- a/src/libtracker/tracker.c
+++ b/src/libtracker/tracker.c
@@ -618,6 +618,19 @@ tracker_metadata_get_unique_values_with_concat_count_and_sum (TrackerClient *cli
}
GPtrArray *
+tracker_metadata_get_unique_values_with_aggregates (TrackerClient *client, ServiceType service, char **meta_types, char *query, char **aggregates, char **aggregate_fields, gboolean descending, int offset, int max_hits, GError **error)
+{
+ GPtrArray *table;
+ const char *service_str = tracker_service_types[service];
+
+ if (!org_freedesktop_Tracker_Metadata_get_unique_values_with_aggregates (client->proxy_metadata, service_str, (const char **)meta_types, query, (const char **)aggregates, (const char **)aggregate_fields, descending, offset, max_hits, &table, &*error)) {
+ return NULL;
+ }
+
+ return table;
+}
+
+GPtrArray *
tracker_keywords_get_list (TrackerClient *client, ServiceType service, GError **error)
{
GPtrArray *table;
@@ -1301,6 +1314,21 @@ tracker_metadata_get_unique_values_with_concat_count_and_sum_async (TrackerClien
}
void
+tracker_metadata_get_unique_values_with_aggregates_async (TrackerClient *client, ServiceType service, char **meta_types, const char *query, char **aggregates, char **aggregate_fields, gboolean descending, int offset, int max_hits, TrackerGPtrArrayReply callback, gpointer user_data)
+{
+
+ GPtrArrayCallBackStruct *callback_struct;
+ const char *service_str = tracker_service_types[service];
+
+ callback_struct = g_new (GPtrArrayCallBackStruct, 1);
+ callback_struct->callback = callback;
+ callback_struct->data = user_data;
+
+ client->last_pending_call = org_freedesktop_Tracker_Metadata_get_unique_values_with_aggregates_async (client->proxy_metadata, service_str, (const char **) meta_types, query, (const char **) aggregates, (const char **) aggregate_fields, descending, offset, max_hits, tracker_GPtrArray_reply, callback_struct);
+
+}
+
+void
tracker_keywords_get_list_async (TrackerClient *client, ServiceType service, TrackerGPtrArrayReply callback, gpointer user_data)
{
diff --git a/src/libtracker/tracker.h b/src/libtracker/tracker.h
index 7a3f1cc..33bf0b0 100644
--- a/src/libtracker/tracker.h
+++ b/src/libtracker/tracker.h
@@ -133,6 +133,7 @@ int tracker_metadata_get_count (TrackerClient *client, ServiceType service, c
GPtrArray * tracker_metadata_get_unique_values_with_count (TrackerClient *client, ServiceType service, char **meta_types, char *query, char *count, gboolean descending, int offset, int max_hits, GError **error);
GPtrArray * tracker_metadata_get_unique_values_with_count_and_sum (TrackerClient *client, ServiceType service, char **meta_types, char *query, char *count, char *sum, gboolean descending, int offset, int max_hits, GError **error);
GPtrArray * tracker_metadata_get_unique_values_with_concat_count_and_sum (TrackerClient *client, ServiceType service, char **meta_types, char *query, char *concat, char *count, char *sum, gboolean descending, int offset, int max_hits, GError **error);
+GPtrArray * tracker_metadata_get_unique_values_with_aggregates (TrackerClient *client, ServiceType service, char **meta_types, char *query, char **aggregates, char **aggregate_fields, gboolean descending, int offset, int max_hits, GError **error);
GPtrArray * tracker_keywords_get_list (TrackerClient *client, ServiceType service, GError **error);
char ** tracker_keywords_get (TrackerClient *client, ServiceType service, const char *id, GError **error);
@@ -198,6 +199,8 @@ void tracker_metadata_get_count_async (TrackerClient *client, ServiceType ser
void tracker_metadata_get_unique_values_with_count_async (TrackerClient *client, ServiceType service, char **meta_types, const char *query, char *count, gboolean descending, int offset, int max_hits, TrackerGPtrArrayReply callback, gpointer user_data);
void tracker_metadata_get_unique_values_with_count_and_sum_async (TrackerClient *client, ServiceType service, char **meta_types, const char *query, char *count, char *sum, gboolean descending, int offset, int max_hits, TrackerGPtrArrayReply callback, gpointer user_data);
void tracker_metadata_get_unique_values_with_concat_count_and_sum_async (TrackerClient *client, ServiceType service, char **meta_types, const char *query, char *concat, char *count, char *sum, gboolean descending, int offset, int max_hits, TrackerGPtrArrayReply callback, gpointer user_data);
+void tracker_metadata_get_unique_values_with_aggregates_async (TrackerClient *client, ServiceType service, char **meta_types, const char *query, char **aggregates, char **aggregate_fields, gboolean descending, int offset, int max_hits, TrackerGPtrArrayReply callback, gpointer user_data);
+
void tracker_keywords_get_list_async (TrackerClient *client, ServiceType service, TrackerGPtrArrayReply callback, gpointer user_data);
void tracker_keywords_get_async (TrackerClient *client, ServiceType service, const char *id, TrackerArrayReply callback, gpointer user_data);
diff --git a/src/tracker-utils/tracker-unique.c b/src/tracker-utils/tracker-unique.c
index 59b340e..ba181c3 100644
--- a/src/tracker-utils/tracker-unique.c
+++ b/src/tracker-utils/tracker-unique.c
@@ -38,9 +38,9 @@
static gchar **fields;
static gchar *service;
static gchar *path;
-static gchar *concat;
-static gchar *count;
-static gchar *sum;
+static gchar **concat;
+static gchar **count;
+static gchar **sum;
static gboolean descending;
static GOptionEntry entries[] = {
@@ -52,15 +52,15 @@ static GOptionEntry entries[] = {
N_("Search from a specific service"),
NULL
},
- { "concat", 'n', 0, G_OPTION_ARG_STRING, &concat,
+ { "concat", 'n', 0, G_OPTION_ARG_STRING_ARRAY, &concat,
N_("Concatenate different values of this field"),
"e.g. File:Mime"
},
- { "count", 'c', 0, G_OPTION_ARG_STRING, &count,
+ { "count", 'c', 0, G_OPTION_ARG_STRING_ARRAY, &count,
N_("Count instances of unique fields of this type"),
"e.g. File:Mime"
},
- { "sum", 'u', 0, G_OPTION_ARG_STRING, &sum,
+ { "sum", 'u', 0, G_OPTION_ARG_STRING_ARRAY, &sum,
N_("Sum the values of this field"),
"e.g. File:Mime"
},
@@ -104,6 +104,10 @@ main (int argc, char **argv)
gchar *buffer = NULL;
gsize size;
GPtrArray *array;
+ gchar **aggregates = NULL;
+ gchar **aggregate_fields = NULL;
+ guint aggregate_count;
+ guint aggregate;
setlocale (LC_ALL, "");
@@ -196,20 +200,72 @@ main (int argc, char **argv)
return EXIT_FAILURE;
}
}
+
+ aggregate_count =
+ (concat ? g_strv_length(concat) : 0) +
+ (sum ? g_strv_length(sum) : 0) +
+ (count ? g_strv_length(count) : 0);
+ aggregate = 0;
+
+ aggregates = g_new0 (gchar*, aggregate_count + 1);
+ aggregate_fields = g_new0 (gchar*, aggregate_count + 1);
+
+ g_debug ("Count of aggregates: %d", aggregate_count);
+
+ if (concat) {
+ guint i;
+ for (i=0;i<g_strv_length (concat);i++) {
+ g_debug ("Concat added for %s", concat[i]);
+
+ aggregates[aggregate] = g_strdup ("CONCAT");
+ aggregate_fields[aggregate] = g_strdup (concat[i]);
+
+ aggregate++;
+ }
+ }
+
+ if (sum) {
+ guint i;
+ for (i=0;i<g_strv_length (sum);i++) {
+ g_debug ("Sum added for %s", sum[i]);
+
+ aggregates[aggregate] = g_strdup ("SUM");
+ aggregate_fields[aggregate] = g_strdup (sum[i]);
+
+ aggregate++;
+ }
+ }
+
+ if (count) {
+ guint i;
+ for (i=0;i<g_strv_length (count);i++) {
+ g_debug ("Count added for %s", count[i]);
- array = tracker_metadata_get_unique_values_with_concat_count_and_sum (client,
- type,
- fields,
- buffer,
- concat,
- count,
- sum,
- descending,
- 0,
- 512,
- &error);
+ aggregates[aggregate] = g_strdup ("COUNT");
+ aggregate_fields[aggregate] = g_strdup (count[i]);
+
+ aggregate++;
+ }
+ }
+
+ aggregates[aggregate_count] = NULL;
+ aggregate_fields[aggregate_count] = NULL;
+
+ array = tracker_metadata_get_unique_values_with_aggregates (client,
+ type,
+ fields,
+ buffer,
+ aggregates,
+ aggregate_fields,
+ descending,
+ 0,
+ 512,
+ &error);
g_free (buffer);
+ g_strfreev (aggregates);
+ g_strfreev (aggregate_fields);
+
if (error) {
g_printerr ("%s, %s\n",
_("Could not query search"),
@@ -240,5 +296,7 @@ main (int argc, char **argv)
tracker_disconnect (client);
+ g_option_context_free (context);
+
return EXIT_SUCCESS;
}
diff --git a/src/trackerd/tracker-metadata.c b/src/trackerd/tracker-metadata.c
index d45e2ae..06872f4 100644
--- a/src/trackerd/tracker-metadata.c
+++ b/src/trackerd/tracker-metadata.c
@@ -869,3 +869,63 @@ tracker_metadata_get_count (TrackerMetadata *object,
tracker_dbus_request_success (request_id);
}
+void
+tracker_metadata_get_unique_values_with_aggregates (TrackerMetadata *object,
+ const gchar *service_type,
+ gchar **fields,
+ const gchar *query_condition,
+ gchar **aggregates,
+ gchar **aggregate_fields,
+ gboolean order_desc,
+ gint offset,
+ gint max_hits,
+ DBusGMethodInvocation *context,
+ GError **error)
+{
+ TrackerDBResultSet *result_set = NULL;
+ guint request_id;
+ GPtrArray *values = NULL;
+ GError *actual_error = NULL;
+
+ request_id = tracker_dbus_get_next_request_id ();
+
+ tracker_dbus_async_return_if_fail (service_type != NULL, context);
+ tracker_dbus_async_return_if_fail (fields != NULL, context);
+ tracker_dbus_async_return_if_fail (query_condition != NULL, context);
+
+ tracker_dbus_request_new (request_id,
+ "DBus request to get unique values with aggregates, "
+ "service type:'%s', query '%s', ",
+ service_type,
+ query_condition);
+
+ result_set =
+ tracker_data_search_get_unique_values_with_aggregates (service_type,
+ fields,
+ query_condition,
+ aggregates,
+ aggregate_fields,
+ order_desc,
+ offset,
+ max_hits,
+ &actual_error);
+
+ if (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;
+ }
+
+ values = tracker_dbus_query_result_to_ptr_array (result_set);
+
+ dbus_g_method_return (context, values);
+
+ tracker_dbus_results_ptr_array_free (&values);
+
+ if (result_set) {
+ g_object_unref (result_set);
+ }
+
+ tracker_dbus_request_success (request_id);
+}
diff --git a/src/trackerd/tracker-metadata.h b/src/trackerd/tracker-metadata.h
index ec51ea2..b7e4419 100644
--- a/src/trackerd/tracker-metadata.h
+++ b/src/trackerd/tracker-metadata.h
@@ -141,6 +141,17 @@ void tracker_metadata_get_unique_values_with_concat_count_and_sum (T
gint max_hits,
DBusGMethodInvocation *context,
GError **error);
+void tracker_metadata_get_unique_values_with_aggregates (TrackerMetadata *object,
+ const gchar *service_type,
+ gchar **fields,
+ const gchar *query_condition,
+ gchar **aggregates,
+ gchar **aggregate_fields,
+ gboolean order_desc,
+ gint offset,
+ gint max_hits,
+ DBusGMethodInvocation *context,
+ GError **error);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]