[bijiben] tracker: use tracker:coalesce to retrieve either BijiItems URL or URN
- From: Pierre-Yves Luyten <pyluyten src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [bijiben] tracker: use tracker:coalesce to retrieve either BijiItems URL or URN
- Date: Thu, 12 Sep 2013 22:17:19 +0000 (UTC)
commit 236381afa098cb59bfad60940c3be61cd203c4f9
Author: Pierre-Yves Luyten <py luyten fr>
Date: Fri Sep 13 00:00:08 2013 +0200
tracker: use tracker:coalesce to retrieve either BijiItems URL or URN
Now that we use nie:url as notes key, and since we still urn:uuid for collections,
we need to use tracker power to retrieve URL or, if none, URN
src/libbiji/biji-tracker.c | 27 +++++++++++++++++++--------
1 files changed, 19 insertions(+), 8 deletions(-)
---
diff --git a/src/libbiji/biji-tracker.c b/src/libbiji/biji-tracker.c
index eb537e6..4f292ec 100644
--- a/src/libbiji/biji-tracker.c
+++ b/src/libbiji/biji-tracker.c
@@ -374,18 +374,29 @@ biji_get_items_matching_async (BijiNoteBook *book,
lower = g_utf8_strdown (needle, -1);
+
+ /* We want to retrieve the key that noteBook uses.
+ * for notes: that is url. A file path is unique.
+ * for collections: we have no url, directly use urn:uuid */
+
query = g_strconcat (
- "SELECT ?url WHERE {",
- " { ?urn a nie:DataObject ;",
- " nie:url ?url ;",
- " nie:title ?title ; nie:plainTextContent ?content ;",
- " nie:generator 'Bijiben' . FILTER (",
+ "SELECT tracker:coalesce (?url, ?urn) WHERE ",
+ "{",
+ " { ?urn a nfo:Note",
+ " .?urn nie:title ?title",
+ " .?urn nie:plainTextContent ?content",
+ " .?urn nie:url ?url",
+ " .?urn nie:generator 'Bijiben'",
+ " .FILTER (",
" fn:contains (fn:lower-case (?content), '", lower, "' ) || ",
" fn:contains (fn:lower-case (?title) , '", lower, "'))} ",
"UNION",
- " { ?url a nfo:DataContainer ;",
- " nie:title ?title ; nie:generator 'Bijiben' . FILTER (",
- " fn:contains (fn:lower-case (?title), '", lower, "'))}}",
+ " { ?urn a nfo:DataContainer",
+ " .?urn nie:title ?title",
+ " .?urn nie:generator 'Bijiben'",
+ " .FILTER (",
+ " fn:contains (fn:lower-case (?title), '", lower, "'))}",
+ "}",
NULL);
g_free (lower);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]