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



commit bfa8f318b2ae9e76c42c0cbb8fd3f260e38c221c
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]