Search
3
LIBTRACKER-CLIENT Library

# Search

Simple search functions.

## Synopsis

    #include <libtracker-client/tracker.h>

    void                (*TrackerReplyArray)                (gchar **result,
                                                             GError *error,
                                                             gpointer user_data);
    TrackerClient *     tracker_connect                     (gboolean enable_warnings,
                                                             gint timeout);
    void                tracker_disconnect                  (TrackerClient *client);
    guint               tracker_search_metadata_by_text_async
                                                            (TrackerClient *client,
                                                             const gchar *query,
                                                             TrackerReplyArray callback,
                                                             gpointer user_data);
    guint               tracker_search_metadata_by_text_and_location_async
                                                            (TrackerClient *client,
                                                             const gchar *query,
                                                             const gchar *location,
                                                             TrackerReplyArray callback,
                                                             gpointer user_data);
    guint               tracker_search_metadata_by_text_and_mime_async
                                                            (TrackerClient *client,
                                                             const gchar *query,
                                                             const gchar **mimes,
                                                             TrackerReplyArray callback,
                                                             gpointer user_data);
    guint               tracker_search_metadata_by_text_and_mime_and_location_async
                                                            (TrackerClient *client,
                                                             const gchar *query,
                                                             const gchar **mimes,
                                                             const gchar *location,
                                                             TrackerReplyArray callback,
                                                             gpointer user_data);

## Description

Simple search API.

## Details

### TrackerReplyArray ()

    void                (*TrackerReplyArray)                (gchar **result,
                                                             GError *error,
                                                             gpointer user_data);

`TrackerReplyArray` has been deprecated since version 0.8 and should not be used in newly-written code. Use TrackerReplyVoid and TrackerReplyGPtrArray with `tracker_resources_sparql_query()` instead.

This is used by the 0.6 Tracker APIs: `tracker_search_metadata_by_text_async()` `tracker_search_metadata_by_text_and_location_async()` `tracker_search_metadata_by_text_and_mime_async()` `tracker_search_metadata_by_text_and_mime_and_location_async()`

`result` :

  a gchar ** with the results of the query.

`error` :

  a GError.

`user_data` :

  a gpointer for user data.

### tracker_connect ()

    TrackerClient *     tracker_connect                     (gboolean enable_warnings,
                                                             gint timeout);

`tracker_connect` has been deprecated since version 0.8 and should not be used in newly-written code. Use `tracker_client_new()` instead.

This function calls `tracker_client_new()`.

`enable_warnings` :

  a gboolean to determine if warnings are issued in cases where they are found.

`timeout` :

  a gint used for D-Bus call timeouts.

Returns :

  a TrackerClient GObject which must be freed with `g_object_unref()`.

### tracker_disconnect ()

    void                tracker_disconnect                  (TrackerClient *client);

`tracker_disconnect` has been deprecated since version 0.8 and should not be used in newly-written code. Use `g_object_unref()` instead.

This will disconnect the D-Bus connections to Tracker services and free the allocated TrackerClient by `tracker_connect()`.

`client` :

  a TrackerClient.

### tracker_search_metadata_by_text_async ()

    guint               tracker_search_metadata_by_text_async
                                                            (TrackerClient *client,
                                                             const gchar *query,
                                                             TrackerReplyArray callback,
                                                             gpointer user_data);

`tracker_search_metadata_by_text_async` has been deprecated since version 0.8 and should not be used in newly-written code. Use `tracker_resources_sparql_query()` instead.

Searches for `query` in all URIs with the prefix `location`.

NOTE: `query` is found using FTS (Full Text Search).

`client` :

  a TrackerClient.

`query` :

  a string representing what to search for.

`callback` :

  callback function to be called when the update has been processed.

`user_data` :

  user data to pass to `callback`.

Returns :

  A guint representing the operation ID. See `tracker_cancel_call()`. In the event of failure, 0 is returned.

### tracker_search_metadata_by_text_and_location_async ()

    guint               tracker_search_metadata_by_text_and_location_async
                                                            (TrackerClient *client,
                                                             const gchar *query,
                                                             const gchar *location,
                                                             TrackerReplyArray callback,
                                                             gpointer user_data);

`tracker_search_metadata_by_text_and_location_async` has been deprecated since version 0.8 and should not be used in newly-written code. Use `tracker_resources_sparql_query()` instead.

Searches for `query` in all URIs with the prefix `location`.

NOTE: `query` is found using FTS (Full Text Search).

`client` :

  a TrackerClient.

`query` :

  a string representing what to search for.

`location` :

  a string representing a path.

`callback` :

  callback function to be called when the update has been processed.

`user_data` :

  user data to pass to `callback`.

Returns :

  A guint representing the operation ID. See `tracker_cancel_call()`. In the event of failure, 0 is returned.

### tracker_search_metadata_by_text_and_mime_async ()

    guint               tracker_search_metadata_by_text_and_mime_async
                                                            (TrackerClient *client,
                                                             const gchar *query,
                                                             const gchar **mimes,
                                                             TrackerReplyArray callback,
                                                             gpointer user_data);

`tracker_search_metadata_by_text_and_mime_async` has been deprecated since version 0.8 and should not be used in newly-written code. Use `tracker_resources_sparql_query()` instead.

Searches for `query` in all URIs with a mime type matching any of the values in `mime`.

NOTE: `query` is found using FTS (Full Text Search).

`client` :

  a TrackerClient.

`query` :

  a string representing what to search for.

`mimes` :

  a GStrv representing mime types.

`callback` :

  callback function to be called when the update has been processed.

`user_data` :

  user data to pass to `callback`.

Returns :

  A guint representing the operation ID. See `tracker_cancel_call()`. In the event of failure, 0 is returned.

### tracker_search_metadata_by_text_and_mime_and_location_async ()

    guint               tracker_search_metadata_by_text_and_mime_and_location_async
                                                            (TrackerClient *client,
                                                             const gchar *query,
                                                             const gchar **mimes,
                                                             const gchar *location,
                                                             TrackerReplyArray callback,
                                                             gpointer user_data);

`tracker_search_metadata_by_text_and_mime_and_location_async` has been deprecated since version 0.8 and should not be used in newly-written code. Use `tracker_resources_sparql_query()` instead.

Searches for `query` in all URIs with the prefix `location` and with a mime type matching any of the values in `mime`.

NOTE: `query` is found using FTS (Full Text Search).

`client` :

  a TrackerClient.

`query` :

  a string representing what to search for.

`mimes` :

  a GStrv representing mime types.

`location` :

  a string representing a path.

`callback` :

  callback function to be called when the update has been processed.

`user_data` :

  user data to pass to `callback`.

Returns :

  A guint representing the operation ID. See `tracker_cancel_call()`. In the event of failure, 0 is returned.