Hey Jamie,
About the Xesam discussion for range-searches, here's a patch that would
add the remote API to the indexer-split branch. If there's some sort of
OK from Mikkel I plan to commit this to the branch (or else adapt it to
the proposed API).
--
Philip Van Hoof, freelance software developer
home: me at pvanhoof dot be
gnome: pvanhoof at gnome dot org
http://pvanhoof.be/blog
http://codeminded.be
--- Begin Message ---
On Wed, 2008-05-07 at 21:16 +0200, Mikkel Kamstrup Erlandsen wrote:
> 2008/5/7 Jamie McCracken <[EMAIL PROTECTED]>:
> I think we would need:
> GetPagedHits
> GetPagedHitData
> to cover all use cases
>
> If there is more than one method needed for paging nirvana it begins
> to make sense to add a org.freedesktop.xesam.PagedSear
> ch interface to the spec. This can go in 1.1 (and if we can mature it
> fast enough it should not be a problem for Nokia to depend upon it
> before 1.1 is out).
Here's a first proposal:
<?xml version="1.0" encoding="UTF-8"?>
<node name="/org/freedesktop/xesam">
<interface name="org.freedesktop.xesam.Search">
...
</interface>
<interface name="org.freedesktop.xesam.PagedSearch">
<method name="GetRangeHits">
<annotation name="org.freedesktop.DBus.GLib.Async" value="true"/>
<arg type="s" name="search" direction="in" />
<arg type="u" name="a" direction="in" />
<arg type="u" name="b" direction="in" />
<arg type="aav" name="hits" direction="out" />
</method>
<method name="GetRangeHitData">
<annotation name="org.freedesktop.DBus.GLib.Async" value="true"/>
<arg type="s" name="search" direction="in" />
<arg type="u" name="a" direction="in" />
<arg type="u" name="b" direction="in" />
<arg type="as" name="fields" direction="in" />
<arg type="aav" name="hit_data" direction="out" />
</method>
</interface>
</node>
--
Philip Van Hoof, freelance software developer
home: me at pvanhoof dot be
gnome: pvanhoof at gnome dot org
http://pvanhoof.be/blog
http://codeminded.be
--- End Message ---
Index: src/trackerd/tracker-xesam-live-search.c
===================================================================
--- src/trackerd/tracker-xesam-live-search.c (revision 1365)
+++ src/trackerd/tracker-xesam-live-search.c (working copy)
@@ -474,6 +474,28 @@
}
}
+void tracker_xesam_live_search_get_range_hits (TrackerXesamLiveSearch *self,
+ guint a,
+ guint b,
+ GPtrArray **hits,
+ GError **error)
+{
+ TrackerXesamLiveSearchPriv *priv = self->priv;
+
+ if (!priv->active)
+ g_set_error (error, TRACKER_XESAM_ERROR,
+ TRACKER_XESAM_ERROR_SEARCH_NOT_ACTIVE,
+ "Search is not active");
+ else {
+ TrackerDBResultSet *result_set = NULL;
+
+ // For ottela: fetch results for get_hits
+
+ get_hit_data (self, result_set, hits);
+ }
+}
+
+
/**
* tracker_xesam_live_search_get_hit_data:
* @self: a #TrackerXesamLiveSearch
@@ -523,6 +545,30 @@
}
}
+
+void
+tracker_xesam_live_search_get_range_hit_data (TrackerXesamLiveSearch *self,
+ guint a,
+ guint b,
+ GStrv fields,
+ GPtrArray **hit_data,
+ GError **error)
+{
+ TrackerXesamLiveSearchPriv *priv = self->priv;
+
+ if (!priv->active)
+ g_set_error (error, TRACKER_XESAM_ERROR,
+ TRACKER_XESAM_ERROR_SEARCH_NOT_ACTIVE,
+ "Search is not active yet");
+ else {
+ TrackerDBResultSet *result_set = NULL;
+
+ // For ottela: fetch results for get_hit_data
+
+ get_hit_data (self, result_set, hit_data);
+ }
+}
+
/**
* tracker_xesam_live_search_is_active:
* @self: a #TrackerXesamLiveSearch
Index: src/trackerd/tracker-xesam-live-search.h
===================================================================
--- src/trackerd/tracker-xesam-live-search.h (revision 1365)
+++ src/trackerd/tracker-xesam-live-search.h (working copy)
@@ -68,6 +68,17 @@
guint count,
GPtrArray **hits,
GError **error);
+void tracker_xesam_live_search_get_range_hit_data (TrackerXesamLiveSearch *self,
+ guint a,
+ guint b,
+ GStrv fields,
+ GPtrArray **hit_data,
+ GError **error);
+void tracker_xesam_live_search_get_range_hits (TrackerXesamLiveSearch *self,
+ guint a,
+ guint b,
+ GPtrArray **hits,
+ GError **error);
void tracker_xesam_live_search_get_hit_count (TrackerXesamLiveSearch *self,
guint *count,
GError **error);
Index: src/trackerd/tracker-dbus-xesam.c
===================================================================
--- src/trackerd/tracker-dbus-xesam.c (revision 1365)
+++ src/trackerd/tracker-dbus-xesam.c (working copy)
@@ -557,6 +557,41 @@
tracker_dbus_request_success (request_id);
}
+
+
+void
+tracker_dbus_xesam_get_range_hits (TrackerDBusXesam *object,
+ const gchar *search_id,
+ guint a,
+ guint b,
+ DBusGMethodInvocation *context)
+{
+ guint request_id = tracker_dbus_get_next_request_id ();
+ GError *error = NULL;
+ TrackerXesamLiveSearch *search = tracker_xesam_get_live_search (search_id, &error);
+
+ if (search) {
+ GPtrArray *hits = NULL;
+ tracker_xesam_live_search_get_range_hits (search, a, b, &hits, &error);
+
+ if (error) {
+ dbus_g_method_return_error (context, error);
+ g_error_free (error);
+ } else {
+ dbus_g_method_return (context, hits);
+ freeup_hits_data (hits);
+ }
+
+ g_object_unref (search);
+ } else if (error) {
+ dbus_g_method_return_error (context, error);
+ g_error_free (error);
+ }
+
+ tracker_dbus_request_success (request_id);
+}
+
+
void
tracker_dbus_xesam_get_hit_data (TrackerDBusXesam *object,
const gchar *search_id,
@@ -590,7 +625,43 @@
tracker_dbus_request_success (request_id);
}
+
+
void
+tracker_dbus_xesam_get_range_hit_data (TrackerDBusXesam *object,
+ const gchar *search_id,
+ guint a,
+ guint b,
+ GStrv fields,
+ DBusGMethodInvocation *context)
+{
+ guint request_id = tracker_dbus_get_next_request_id ();
+ GError *error = NULL;
+ TrackerXesamLiveSearch *search = tracker_xesam_get_live_search (search_id, &error);
+
+ if (search) {
+ GPtrArray *hit_data = NULL;
+ tracker_xesam_live_search_get_range_hit_data (search, a, b, fields, &hit_data, &error);
+
+ if (error) {
+ dbus_g_method_return_error (context, error);
+ g_error_free (error);
+ } else {
+ dbus_g_method_return (context, hit_data);
+ freeup_hits_data (hit_data);
+ }
+
+
+ g_object_unref (search);
+ } else if (error) {
+ dbus_g_method_return_error (context, error);
+ g_error_free (error);
+ }
+
+ tracker_dbus_request_success (request_id);
+}
+
+void
tracker_dbus_xesam_close_search (TrackerDBusXesam *object,
const gchar *search_id,
DBusGMethodInvocation *context)
Index: src/trackerd/tracker-dbus-xesam.h
===================================================================
--- src/trackerd/tracker-dbus-xesam.h (revision 1365)
+++ src/trackerd/tracker-dbus-xesam.h (working copy)
@@ -58,50 +58,61 @@
TrackerDBusXesam *
tracker_dbus_xesam_new (DBConnection *db_con);
void tracker_dbus_xesam_new_session (TrackerDBusXesam *object,
- DBusGMethodInvocation *context);
+ DBusGMethodInvocation *context);
void tracker_dbus_xesam_set_property (TrackerDBusXesam *object,
- const gchar *session_id,
- const gchar *prop,
- GValue *val,
- DBusGMethodInvocation *context);
+ const gchar *session_id,
+ const gchar *prop,
+ GValue *val,
+ DBusGMethodInvocation *context);
void tracker_dbus_xesam_get_property (TrackerDBusXesam *object,
- const gchar *session_id,
- const gchar *prop,
- DBusGMethodInvocation *context);
+ const gchar *session_id,
+ const gchar *prop,
+ DBusGMethodInvocation *context);
void tracker_dbus_xesam_close_session (TrackerDBusXesam *object,
- const gchar *session_id,
- DBusGMethodInvocation *context);
+ const gchar *session_id,
+ DBusGMethodInvocation *context);
void tracker_dbus_xesam_new_search (TrackerDBusXesam *object,
- const gchar *session_id,
- const gchar *query_xml,
- DBusGMethodInvocation *context);
+ const gchar *session_id,
+ const gchar *query_xml,
+ DBusGMethodInvocation *context);
void tracker_dbus_xesam_start_search (TrackerDBusXesam *object,
- const gchar *search_id,
- DBusGMethodInvocation *context);
+ const gchar *search_id,
+ DBusGMethodInvocation *context);
void tracker_dbus_xesam_get_hit_count (TrackerDBusXesam *object,
- const gchar *search_id,
- DBusGMethodInvocation *context);
+ const gchar *search_id,
+ DBusGMethodInvocation *context);
void tracker_dbus_xesam_get_hits (TrackerDBusXesam *object,
- const gchar *search_id,
- guint count,
- DBusGMethodInvocation *context);
+ const gchar *search_id,
+ guint count,
+ DBusGMethodInvocation *context);
+void tracker_dbus_xesam_get_range_hits (TrackerDBusXesam *object,
+ const gchar *search_id,
+ guint a,
+ guint b,
+ DBusGMethodInvocation *context);
void tracker_dbus_xesam_get_hit_data (TrackerDBusXesam *object,
- const gchar *search_id,
- GArray *hit_ids,
- GStrv fields,
- DBusGMethodInvocation *context);
+ const gchar *search_id,
+ GArray *hit_ids,
+ GStrv fields,
+ DBusGMethodInvocation *context);
+void tracker_dbus_xesam_get_range_hit_data (TrackerDBusXesam *object,
+ const gchar *search_id,
+ guint a,
+ guint b,
+ GStrv fields,
+ DBusGMethodInvocation *context);
void tracker_dbus_xesam_close_search (TrackerDBusXesam *object,
- const gchar *search_id,
- DBusGMethodInvocation *context);
+ const gchar *search_id,
+ DBusGMethodInvocation *context);
void tracker_dbus_xesam_get_state (TrackerDBusXesam *object,
- DBusGMethodInvocation *context);
+ DBusGMethodInvocation *context);
void tracker_dbus_xesam_emit_state_changed (TrackerDBusXesam *self,
- GStrv state_info);
+ GStrv state_info);
void tracker_dbus_xesam_name_owner_changed (DBusGProxy *proxy,
- const char *name,
- const char *prev_owner,
- const char *new_owner,
- TrackerDBusXesam *self);
+ const char *name,
+ const char *prev_owner,
+ const char *new_owner,
+ TrackerDBusXesam *self);
void tracker_dbus_xesam_set_db_connection (TrackerDBusXesam *object,
DBConnection *db_con);
Index: data/tracker-dbus-xesam.xml
===================================================================
--- data/tracker-dbus-xesam.xml (revision 1365)
+++ data/tracker-dbus-xesam.xml (working copy)
@@ -101,4 +101,23 @@
</signal>
</interface>
+ <interface name="org.freedesktop.xesam.PagedSearch">
+ <method name="GetRangeHits">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/>
+ <arg type="s" name="search" direction="in" />
+ <arg type="u" name="a" direction="in" />
+ <arg type="u" name="b" direction="in" />
+ <arg type="aav" name="hits" direction="out" />
+ </method>
+
+ <method name="GetRangeHitData">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/>
+ <arg type="s" name="search" direction="in" />
+ <arg type="u" name="a" direction="in" />
+ <arg type="u" name="b" direction="in" />
+ <arg type="as" name="fields" direction="in" />
+ <arg type="aav" name="hit_data" direction="out" />
+ </method>
+ </interface>
+
</node>
_______________________________________________
tracker-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/tracker-list