mirror of
https://github.com/samba-team/samba.git
synced 2024-12-24 21:34:56 +03:00
1ef96e0907
This moves all Tracker backend logic into a modularized component. This should not result in any change in behaviour, it just paves the way for adding additional backends. Currently the only available backend is Gnome Tracker. slq_destroy_send/recv is not needed anymore as the problem is solved now by correctly checking if an async Tracker request was cancelled and we got G_IO_ERROR_CANCELLED in tracker_con_cb() or tracker_query_cb() and avoid using user_data in that the case. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
48 lines
929 B
C
48 lines
929 B
C
#include "includes.h"
|
|
#include "mdssvc.h"
|
|
#include "rpc_server/mdssvc/sparql_parser.tab.h"
|
|
#include "rpc_server/mdssvc/mdssvc_tracker.h"
|
|
|
|
/*
|
|
* Examples:
|
|
*
|
|
* $ ./spotlight2sparql '_kMDItemGroupId=="11"'
|
|
* ...
|
|
* $ ./spotlight2sparql '*=="test*"cwd||kMDItemTextContent=="test*"cwd'
|
|
* ...
|
|
*/
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
struct sl_tracker_query *tq = NULL;
|
|
bool ok;
|
|
struct sl_query *slq;
|
|
|
|
if (argc != 2) {
|
|
printf("usage: %s QUERY\n", argv[0]);
|
|
return 1;
|
|
}
|
|
|
|
slq = talloc_zero(NULL, struct sl_query);
|
|
if (slq == NULL) {
|
|
printf("talloc error\n");
|
|
return 1;
|
|
}
|
|
|
|
slq->query_string = argv[1];
|
|
slq->path_scope = "/foo/bar";
|
|
|
|
tq = talloc_zero(slq, struct sl_tracker_query);
|
|
if (tq == NULL) {
|
|
printf("talloc error\n");
|
|
return 1;
|
|
}
|
|
slq->backend_private = tq;
|
|
|
|
ok = map_spotlight_to_sparql_query(slq);
|
|
printf("%s\n", ok ? tq->sparql_query : "*mapping failed*");
|
|
|
|
talloc_free(slq);
|
|
return ok ? 0 : 1;
|
|
}
|