![]() |
![]() |
![]() |
API Documentation for the Zeitgeist Client Library | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy |
#include <zeitgeist.h> ZeitgeistIndex; struct ZeitgeistIndexClass; ZeitgeistIndex * zeitgeist_index_new (void
); void zeitgeist_index_search (ZeitgeistIndex *self
,const gchar *query
,ZeitgeistTimeRange *time_range
,GPtrArray *event_templates
,guint32 offset
,guint32 num_events
,ZeitgeistResultType result_type
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
); ZeitgeistResultSet * zeitgeist_index_search_finish (ZeitgeistIndex *self
,GAsyncResult *res
,GError **error
); void zeitgeist_index_search_with_relevancies (ZeitgeistIndex *self
,const gchar *query
,ZeitgeistTimeRange *time_range
,GPtrArray *event_templates
,ZeitgeistStorageState storage_state
,guint32 offset
,guint32 num_events
,ZeitgeistResultType result_type
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
); ZeitgeistResultSet* zeitgeist_index_search_with_relevancies_finish (ZeitgeistIndex *self
,GAsyncResult *res
,gdouble **relevancies
,gint *relevancies_size
,GError **error
);
ZeitgeistIndex * zeitgeist_index_new (void
);
Create a new ZeitgeistIndex instance. The index will start to connect to Zeitgeist asynchronously. You can however start calling methods on the returned instance immediately, any method calls issued before the connection has been established will simply be queued and executed once the connection is up.
Returns : |
A reference to a newly allocated index. Free with g_object_unref() . |
void zeitgeist_index_search (ZeitgeistIndex *self
,const gchar *query
,ZeitgeistTimeRange *time_range
,GPtrArray *event_templates
,guint32 offset
,guint32 num_events
,ZeitgeistResultType result_type
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Perform a full text search possibly restricted to a ZeitgeistTimeRange and/or set of event templates.
The default boolean operator is AND
. Thus the query
foo bar will be interpreted as
foo AND bar. To exclude a term from the result
set prepend it with a minus sign - eg foo -bar.
Phrase queries can be done by double quoting the string
"foo is a bar". You can truncate terms by appending
a *.
There are a few keys you can prefix to a term or phrase to search within a specific set of metadata. They are used like key:value. The keys name and title search strictly within the text field of the event subjects. The key app searches within the application name or description that is found in the actor attribute of the events. Lastly you can use the site key to search within the domain name of the subject URIs.
You can also control the results with the boolean operators AND and OR and you may use brackets, ( and ), to control the operator precedence.
|
The ZeitgeistIndex you want to query |
|
The search string to send to Zeitgeist |
|
Restrict matched events to ones within this time range. If you
are not interested in restricting the timerange pass
zeitgeist_time_range_new_anytime() as Zeitgeist will detect this
and optimize the query accordingly |
|
Restrict matches events to ones matching these templates |
|
Offset into the result set to read events from |
|
Maximal number of events to retrieve |
|
The ZeitgeistResultType determining the sort order.
You may pass ZEITGEIST_RESULT_TYPE_RELEVANCY to this method
to have the results ordered by relevancy calculated in relation
to query
|
|
A GCancellable used to cancel the call or NULL
|
|
A GAsyncReadyCallback to invoke when the search results are ready |
|
User data to pass back with callback
|
ZeitgeistResultSet * zeitgeist_index_search_finish (ZeitgeistIndex *self
,GAsyncResult *res
,GError **error
);
Retrieve the result from an asynchronous query started with
zeitgeist_index_search()
.
The total hit count of the query will be available via the returned
result set by calling zeitgeist_result_set_estimated_matches()
. This will
often be bigger than the actual number of events held in the result set,
which is limited by the num_events
parameter passed to
zeitgeist_index_search()
.
|
The ZeitgeistIndex to retrieve results from |
|
The GAsyncResult you received in the GAsyncReadyCallback you passed
to zeitgeist_index_search()
|
|
A place to store a GError or NULL in case you want to ignore errors |
Returns : |
A newly allocated ZeitgeistResultSet containing the
ZeitgeistEvents matching the query. You must free the
result set with g_object_unref() . The events held in the result set
will automatically be unreffed when it is finalized. |
void zeitgeist_index_search_with_relevancies (ZeitgeistIndex *self
,const gchar *query
,ZeitgeistTimeRange *time_range
,GPtrArray *event_templates
,ZeitgeistStorageState storage_state
,guint32 offset
,guint32 num_events
,ZeitgeistResultType result_type
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Perform a full text search possibly restricted to a ZeitgeistTimeRange
and/or set of event templates. As opposed to zeitgeist_index_search()
, this
call will also return numeric relevancies of the events
in the ZeitgeistResultSet.
See zeitgeist_index_search()
for more details on how to create the query.
|
The ZeitgeistIndex you want to query |
|
The search string to send to Zeitgeist |
|
Restrict matched events to ones within this time range. If you
are not interested in restricting the timerange pass
zeitgeist_time_range_new_anytime() as Zeitgeist will detect this
and optimize the query accordingly |
|
Restrict matched events to ones matching these templates |
|
Filter the events by availability of the storage medium. |
|
Offset into the result set to read events from |
|
Maximal number of events to retrieve |
|
The ZeitgeistResultType determining the sort order.
You may pass ZEITGEIST_RESULT_TYPE_RELEVANCY to this method
to have the results ordered by relevancy calculated in relation
to query
|
|
A GCancellable used to cancel the call or NULL
|
|
A GAsyncReadyCallback to invoke when the search results are ready |
|
User data to pass back with callback
|
ZeitgeistResultSet* zeitgeist_index_search_with_relevancies_finish (ZeitgeistIndex *self
,GAsyncResult *res
,gdouble **relevancies
,gint *relevancies_size
,GError **error
);
Retrieve the result from an asynchronous query started with
zeitgeist_index_search_with_relevancies()
.
The total hit count of the query will be available via the returned
result set by calling zeitgeist_result_set_estimated_matches()
. This will
often be bigger than the actual number of events held in the result set,
which is limited by the num_events
parameter passed to
zeitgeist_index_search_with_relevancies()
.
|
The ZeitgeistIndex to retrieve results from |
|
The GAsyncResult you received in the GAsyncReadyCallback you passed
to zeitgeist_index_search_with_relevancies()
|
|
Location for the newly allocated array with relevancies. [out][array] |
|
Location for the size of the newly allocated array. [out] |
|
A place to store a GError or NULL in case you want to ignore errors |
Returns : |
A newly allocated ZeitgeistResultSet containing the
ZeitgeistEvents matching the query. You must free the
result set with g_object_unref() . The events held in the result set
will automatically be unreffed when it is finalized. |