[nautilus/wip/csoriano/search-popover: 10/43] search-engine-tracker: fix date bounds



commit 245a7a445c4344d0b072fe7b988f66a7c7c7fce3
Author: Carlos Soriano <csoriano gnome org>
Date:   Tue Feb 2 15:21:28 2016 +0100

    search-engine-tracker: fix date bounds
    
    With the previous patch we set the correct bound for the dates,
    however due to https://bugzilla.gnome.org/show_bug.cgi?id=761455
    bug in tracker, we cannot use dates vars defined in the SELECT clause
    in the WHERE clause.
    
    After discussing the nautilsu query to tracker, we came up that it's
    not needed to use OPTIONAl and coalesce for it, since contentAccessed
    is not something that will be set for files, instead the file ontology
    should be used.
    
    So just remove the coalesce and move the variables definitions to the
    WHERE clause to make them with the correct type.

 .../nautilus-search-engine-tracker.c               |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/libnautilus-private/nautilus-search-engine-tracker.c 
b/libnautilus-private/nautilus-search-engine-tracker.c
index 6aeb194..17cd5b8 100644
--- a/libnautilus-private/nautilus-search-engine-tracker.c
+++ b/libnautilus-private/nautilus-search-engine-tracker.c
@@ -298,16 +298,20 @@ nautilus_search_engine_tracker_start (NautilusSearchProvider *provider)
 
        mime_count = g_list_length (mimetypes);
 
-       sparql = g_string_new ("SELECT DISTINCT nie:url(?urn) fts:rank(?urn) 
tracker:coalesce(nfo:fileLastModified(?urn), nie:contentLastModified(?urn)) AS ?mtime 
tracker:coalesce(nfo:fileLastAccessed(?urn), nie:contentAccessed(?urn)) AS ?atime \n"
+       sparql = g_string_new ("SELECT DISTINCT nie:url(?urn) fts:rank(?urn) nfo:fileLastModified(?urn) 
nfo:fileLastAccessed(?urn)\n"
                               "WHERE {"
-                              "  ?urn a nfo:FileDataObject ;"
-                              "  tracker:available true ; ");
+                              "  ?urn a nfo:FileDataObject;"
+                               "  nfo:fileLastModified ?mtime;"
+                               "  nfo:fileLastAccessed ?atime;"
+                              "  tracker:available true;");
+
+        g_string_append_printf (sparql, " fts:match '\"%s*\"'", search_text);
 
        if (mime_count > 0) {
-               g_string_append (sparql, "nie:mimeType ?mime ;");
+               g_string_append (sparql, "; nie:mimeType ?mime");
        }
 
-       g_string_append_printf (sparql, " fts:match '\"%s*\"' . FILTER ( ", search_text);
+        g_string_append_printf (sparql, " . FILTER( ");
 
        if (!tracker->details->recursive) {
                g_string_append_printf (sparql, "tracker:uri-is-parent('%s', nie:url(?urn)) && ", 
location_uri);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]