[bijiben] tracker : do not use fts, rather fn:contains
- From: Pierre-Yves Luyten <pyluyten src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [bijiben] tracker : do not use fts, rather fn:contains
- Date: Sun, 12 May 2013 00:31:59 +0000 (UTC)
commit 19512c4719388210fc5bcf7306a65b7658412b03
Author: Pierre-Yves Luyten <py luyten fr>
Date: Sun May 12 02:23:06 2013 +0200
tracker : do not use fts, rather fn:contains
we look for any number of input characters
and do not exclude anything from search
See #699656
src/libbiji/biji-tracker.c | 21 ++++++++++++++++-----
1 files changed, 16 insertions(+), 5 deletions(-)
---
diff --git a/src/libbiji/biji-tracker.c b/src/libbiji/biji-tracker.c
index 76ab386..c8eeae4 100644
--- a/src/libbiji/biji-tracker.c
+++ b/src/libbiji/biji-tracker.c
@@ -346,17 +346,28 @@ biji_get_notes_with_strings_or_collection_finish (GObject *source_object,
}
/* FIXME : the nie:isPartOf returns file://$path, while
- * union fts returns $path which leads to uggly code
- * TODO : not case sensitive */
+ * union fts returns $path which leads to uggly code */
void
biji_get_notes_with_string_or_collection_async (gchar *needle, GAsyncReadyCallback f, gpointer user_data)
{
+ gchar *lower;
gchar *query;
- query = g_strdup_printf ("SELECT ?s WHERE {{?c nie:isPartOf ?s; nie:title '%s'} \
- UNION {?s fts:match '%s'. ?s nie:generator 'Bijiben'}}",
- needle, needle);
+ lower = g_utf8_strdown (needle, -1);
+ query = g_strconcat (
+ "SELECT ?urn WHERE {",
+ " { ?urn a nie:DataObject ;",
+ " nie:title ?title ; nie:plainTextContent ?content ;",
+ " nie:generator 'Bijiben' . FILTER (",
+ " fn:contains (fn:lower-case (?content), '", lower, "' ) || ",
+ " fn:contains (fn:lower-case (?title) , '", lower, "'))} ",
+ "UNION",
+ " { ?urn a nfo:DataContainer ;",
+ " nie:title ?title ; nie:generator 'Bijiben' . FILTER (",
+ " fn:contains (fn:lower-case (?title), '", lower, "'))}}",
+ NULL);
+ g_free (lower);
bjb_perform_query_async (query, f, user_data);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]