]> arthur.barton.de Git - netatalk.git/commitdiff
Modify SPARQL query
authorFrank Lahm <franklahm@googlemail.com>
Mon, 15 Oct 2012 17:05:11 +0000 (19:05 +0200)
committerFrank Lahm <franklahm@googlemail.com>
Mon, 15 Oct 2012 17:05:11 +0000 (19:05 +0200)
etc/afpd/spotlight_module.c

index 05813725a0d58d3dcabd95f3937bde8edd25dc7a..5ea1e95d1ec773f86c6fddcc6df6690f30db4bb4 100644 (file)
@@ -64,7 +64,7 @@ static const gchar *map_spotlight_to_sparql_query(slq_t *slq)
 {
     EC_INIT;
     const gchar *sparql_query;
-    const char *sparql_query_format = "SELECT nie:url(?f) WHERE { ?f nie:url ?name FILTER regex(?name, \"%s\")}";
+    const char *sparql_query_format = "SELECT nie:url(?uri) WHERE {?uri fts:match '%s' . ?uri nie:url ?url FILTER(fn:starts-with(?url, 'file://%s')) }";
     const char *slquery = slq->slq_qstring;
     char *word, *p;
 
@@ -75,9 +75,8 @@ static const gchar *map_spotlight_to_sparql_query(slq_t *slq)
     EC_NULL( word = dalloc_strdup(slq, word) );
     /* Search asterisk */
     EC_NULL_LOG( p = strchr(word, '*') );
-    *p = 0;
-
-    sparql_query = talloc_asprintf(slq, sparql_query_format, word);
+    p[1] = 0;
+    sparql_query = talloc_asprintf(slq, sparql_query_format, word, slq->slq_vol->v_path);
 
     LOG(log_debug, logtype_sl, "query_word_from_sl_query: \"%s\"", sparql_query);