[gnome-books/wip/carlosg/tracker3: 12/15] query: Fix filename lookup in queries




commit 771051a211b89cd7484ae5ded94eaf354f54591e
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Feb 16 13:04:45 2021 +0100

    query: Fix filename lookup in queries
    
    Coalesce the nfo:fileName of the resource (if we have access to
    it) with runtime function call (if we only have the URI at hand
    but no access to the nfo:FileDataObject)

 src/query.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/src/query.js b/src/query.js
index 4fc94b6b..3600f1c4 100644
--- a/src/query.js
+++ b/src/query.js
@@ -145,7 +145,7 @@ var QueryBuilder = new Lang.Class({
     _buildQueryInternal: function(global, flags, offsetController, sortBy) {
        let selectClauses =
             '    (nie:isStoredAs(?urn) AS ?uri) ' +
-            '    (nfo:fileName(?urn) AS ?filename) ' +
+            '    (COALESCE (nfo:fileName(nie:isStoredAs(?urn)), 
tracker:string-from-filename(nie:isStoredAs(?urn))) AS ?filename) ' +
             '    (nie:mimeType(?urn) AS ?mimetype) ' +
             '    (nie:title(?urn) AS ?title) ' +
             '    (tracker:coalesce(nco:fullname(?creator), nco:fullname(?publisher), \'\') AS ?author) ' +


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